1234567891011121314151617181920212223242526272829303132333435363738394041 |
- /*
- * 2D Game Engine
- * KeyboardMovement.h:
- * Based on pikuma.com 2D game engine in C++ and Lua course
- * Copyright (c) 2021 986-Studio. All rights reserved.
- *
- * Created by Manoël Trapier on 16/02/2021.
- */
- #ifndef GAMEENGINE_SOURCE_INCLUDE_SYSTEMS_KEYBOARDMOVEMENT_H
- #define GAMEENGINE_SOURCE_INCLUDE_SYSTEMS_KEYBOARDMOVEMENT_H
- #include <ECS.h>
- #include <Events/KeyPressed.h>
- class KeyboardMovementSystem : public System
- {
- public:
- KeyboardMovementSystem()
- {
- /* No component to register */
- }
- void subscriptToEvents(std::unique_ptr<EventBus> &eventBus)
- {
- eventBus->subscribeToEvent<KeyPressedEvent>(this, &KeyboardMovementSystem::onKeyPressed);
- }
- void onKeyPressed(KeyPressedEvent &event)
- {
- Logger::Debug("Keyboard: the key '%c' was pressed", event.keyCode);
- }
- void Update()
- {
- }
- };
- #endif /* GAMEENGINE_SOURCE_INCLUDE_SYSTEMS_KEYBOARDMOVEMENT_H */
|