aboutsummaryrefslogtreecommitdiff
path: root/game/QuitScript.cpp
blob: e48863fbe74cf06944328b09995af59d643dab43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "QuitScript.h"
#include "api/Event.h"
#include "api/KeyCodes.h"


using namespace crepe;

bool QuitScript::on_event(const KeyPressEvent & ev){
	if (Keycode::ESCAPE == ev.key) {
		trigger_event<ShutDownEvent>(ShutDownEvent{});
	}
	return false;
}



void QuitScript::init(){
	subscribe<KeyPressEvent>([this](const KeyPressEvent & ev) -> bool {
		return this->on_event(ev);
	});
}