aboutsummaryrefslogtreecommitdiff
path: root/mwe/events/src/loopManager.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-16 15:26:54 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-16 15:26:54 +0100
commit6b3feac981ce78144fb69e490640a4b07dd29f1d (patch)
tree88c9a7b1b03ada97a8152591deb035681f99b7c8 /mwe/events/src/loopManager.cpp
parent8209678e20605936b2ce58331c1a65d8f23fee91 (diff)
parent9f6475e7b0698c414138e2a8140b47f01ce9c5d1 (diff)
Merge branch 'master' of https://github.com/lonkaars/crepe into wouter/events
Diffstat (limited to 'mwe/events/src/loopManager.cpp')
-rw-r--r--mwe/events/src/loopManager.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/mwe/events/src/loopManager.cpp b/mwe/events/src/loopManager.cpp
index 0b7d888..c58a5e7 100644
--- a/mwe/events/src/loopManager.cpp
+++ b/mwe/events/src/loopManager.cpp
@@ -1,8 +1,7 @@
#include "loopManager.h"
LoopManager::LoopManager() : inputSystem(std::make_unique<InputSystem>()) {
- shutdownHandler
- = [this](const ShutDownEvent & event) { this->onShutdown(event); };
+ shutdownHandler = [this](const ShutDownEvent & event) { this->onShutdown(event); };
subscribe(shutdownHandler);
}
void LoopManager::processInput() {
@@ -63,17 +62,15 @@ void LoopManager::setup() {
subscribe<KeyPressedEvent>(callback, false);
EventHandler<MousePressedEvent> mouseCallback = onMouse;
subscribe<MousePressedEvent>(mouseCallback, false);
- EventHandler<KeyPressedEvent> closeWindowCallback
- = [this](const KeyPressedEvent & e) {
- if (e.getKeyCode() == Escape) {
- this->setRunning(false);
- }
- };
+ EventHandler<KeyPressedEvent> closeWindowCallback = [this](const KeyPressedEvent & e) {
+ if (e.getKeyCode() == Escape) {
+ this->setRunning(false);
+ }
+ };
subscribe<KeyPressedEvent>(closeWindowCallback, false);
Button * testButton = new Button(200, 200);
testButton->color = {100, 0, 100};
- testButton->onClick
- = []() { std::cout << "Button was clicked" << std::endl; };
+ testButton->onClick = []() { std::cout << "Button was clicked" << std::endl; };
testButton->x = 200;
testButton->y = 200;
inputSystem->registerButton(testButton);
@@ -93,9 +90,7 @@ void LoopManager::render() {
window.renderUIObjects();
}
}
-void LoopManager::onShutdown(const ShutDownEvent & e) {
- this->gameRunning = false;
-}
+void LoopManager::onShutdown(const ShutDownEvent & e) { this->gameRunning = false; }
void LoopManager::update() {
//fprintf(stderr, "**********normal update********** \n");
LoopTimer & timer = LoopTimer::getInstance();