diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2025-01-05 16:36:38 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2025-01-05 16:36:38 +0100 |
commit | 2726785d64aa117aff0791d4591046c442709aac (patch) | |
tree | ce5b7d2fb240e87597d70e1f1be544e9672212e3 /game/hud/SpeedScript.cpp | |
parent | ba170d00586ab261e015cc2febbb43f9aa7ae43e (diff) |
improved hud
Diffstat (limited to 'game/hud/SpeedScript.cpp')
-rw-r--r-- | game/hud/SpeedScript.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/game/hud/SpeedScript.cpp b/game/hud/SpeedScript.cpp new file mode 100644 index 0000000..c0d927c --- /dev/null +++ b/game/hud/SpeedScript.cpp @@ -0,0 +1,28 @@ +#include "SpeedScript.h" +#include "api/KeyCodes.h" +#include "manager/LoopTimerManager.h" + +using namespace crepe; +using namespace std; + +void SpeedScript::fixed_update(crepe::duration_t dt){ + LoopTimerManager & lp = this->get_loop_timer(); + if(this->get_key_state(Keycode::HOME)){ + if(toggle) + { + this->timescale = lp.get_time_scale(); + lp.set_time_scale(0); + toggle = false; + } + else { + lp.set_time_scale(this->timescale); + toggle = true; + } + } + if(this->get_key_state(Keycode::PAGE_UP)){ + lp.set_time_scale(lp.get_time_scale()+0.1); + } + if(this->get_key_state(Keycode::PAGE_DOWN)){ + lp.set_time_scale(lp.get_time_scale()-0.1); + } +} |