aboutsummaryrefslogtreecommitdiff
path: root/game/hud/SpeedScript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'game/hud/SpeedScript.cpp')
-rw-r--r--game/hud/SpeedScript.cpp28
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);
+ }
+}