diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-08 15:03:14 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-08 15:03:14 +0100 |
commit | 261a2cfd2bedafbc7fcf54e1b86adee206dea519 (patch) | |
tree | f099bca292e99ae54035f9a5ac7a455eec073c3e /game/hud/SpeedScript.cpp | |
parent | d9c67da9b8c2d8d25ef4dd2c700ddc78573d3a60 (diff) | |
parent | 0b9574bdd6c5968c07bcf165d66032b75649b5da (diff) |
merge w/ master
Diffstat (limited to 'game/hud/SpeedScript.cpp')
-rw-r--r-- | game/hud/SpeedScript.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/game/hud/SpeedScript.cpp b/game/hud/SpeedScript.cpp index 69534d9..d0a4dfe 100644 --- a/game/hud/SpeedScript.cpp +++ b/game/hud/SpeedScript.cpp @@ -1,22 +1,21 @@ #include "SpeedScript.h" -#include "api/Event.h" -#include "api/KeyCodes.h" -#include "manager/LoopTimerManager.h" + +#include <crepe/api/Event.h> +#include <crepe/api/KeyCodes.h> +#include <crepe/manager/LoopTimerManager.h> using namespace crepe; using namespace std; void SpeedScript::init() { this->subscribe<KeyPressEvent>([this](const KeyPressEvent & ev) -> bool { - if(ev.key != Keycode::HOME) return false; - LoopTimerManager & lp = this->get_loop_timer(); + if (ev.key != Keycode::HOME) return false; + LoopTimerManager & lp = this->get_loop_timer(); this->toggle = !this->toggle; - if(this->toggle) - { - this->timescale = lp.get_time_scale(); + if (this->toggle) { + this->timescale = lp.get_time_scale(); lp.set_time_scale(0); - } - else { + } else { lp.set_time_scale(this->timescale); } @@ -24,12 +23,12 @@ void SpeedScript::init() { }); } -void SpeedScript::fixed_update(crepe::duration_t dt){ - LoopTimerManager & lp = this->get_loop_timer(); - if(this->get_key_state(Keycode::PAGE_UP)){ - lp.set_time_scale(lp.get_time_scale()+0.1); +void SpeedScript::fixed_update(crepe::duration_t dt) { + LoopTimerManager & lp = this->get_loop_timer(); + 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); + if (this->get_key_state(Keycode::PAGE_DOWN)) { + lp.set_time_scale(lp.get_time_scale() - 0.1); } } |