0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 13:43:41 +00:00
SDL_Minigame/include/InputSystemComponent.h
Sara Varga cefa1c2e29 added InputSystemComponent
needs testing
2024-06-21 22:47:36 +02:00

29 lines
688 B
C++

#pragma once
#include <map>
#include <vector>
#include <functional>
#include "Component.h"
#include "InputComponent.h"
#include "InputAction.h"
class InputSystemComponent : public InputComponent {
public:
InputSystemComponent() = default;
~InputSystemComponent() = default;
void init() override;
void update() override;
void bindAction(const std::string& actionName, Key key, std::function<void()> callback);
void unbindAction(const std::string& actionName, Key key);
private:
InputComponent* m_inputComponent;
std::map<Key, std::vector<InputAction>> m_keyToActionsMap;
std::map<std::string, InputAction> m_actions;
void handleActions();
};