diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-18 15:08:31 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-18 15:08:31 +0100 |
commit | fee42c67918a9370f7f4e074dba9a677afccf90b (patch) | |
tree | c5ed200e3c584fafc4c6bd3df48adeed3cfbd31d /mwe/events/src/loopManager.cpp | |
parent | ed1403aea4412bd479244eae8e2940190e71cd28 (diff) | |
parent | 121b64b1cb6cfead5814070c8b0185d3d7308095 (diff) |
Merge remote-tracking branch 'origin/master' into niels/RenderingParticle
Diffstat (limited to 'mwe/events/src/loopManager.cpp')
-rw-r--r-- | mwe/events/src/loopManager.cpp | 21 |
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(); |