aboutsummaryrefslogtreecommitdiff
path: root/game/hud/SpeedScript.cpp
blob: c0d927c471e9ca797a181b5d6058905f21b5e6c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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);
	}
}