Refactored InputProxy to gracefully handle cases where multiple origins send the same command

This commit is contained in:
2015-12-11 17:15:33 +01:00
parent 2e7e8d3546
commit 03e226ffea
7 changed files with 104 additions and 44 deletions
@@ -12,10 +12,12 @@ public:
KeyboardInputHandler(EventBroker* eventBroker, InputProxy* inputProxy);
bool BindOrigin(std::string origin, std::string command, float value) override;
virtual float GetCommandValue(std::string command) override;
private:
std::unordered_map<std::string, int> m_OriginKeyCodes;
std::unordered_map<int, std::tuple<std::string, float>> m_KeyBindings; // GLFW_KEY... -> command string & value
std::unordered_map<std::string, float> m_CommandValues;
EventRelay<InputHandler, Events::KeyDown> m_EKeyDown;
bool OnKeyDown(const Events::KeyDown& e);