This commit is contained in:
Anselme 2018-01-23 20:17:35 +01:00
commit c543e253c6
3 changed files with 13 additions and 1 deletions

View File

@ -200,7 +200,16 @@ std::vector<Action> Input::getActions()
}
/* context-related functions */
void Input::updateKeyBindings(){
std::vector<std::string> Input::getContextsList()
{
std::vector<std::string> res;
for(auto context : m_contexts)
res.push_back(context.getName());
return res;
}
void Input::updateKeyBindings()
{
m_keybindings.clear();
for (auto iter= m_contexts.begin(); iter != m_contexts.end(); ++iter)
m_keybindings[iter->getName()]= KeyBindings(*iter,m_keysmap);

View File

@ -55,6 +55,7 @@ public:
/* general action-mapping functions */
void setKeysMap(IKeysMap km); //set bindings
IKeysMap getKeysMap(){return m_keysmap;}
void updateEvents(); //handle the input and put the associated event in the file
std::vector<Action> getActions(); //get the first action in the file of event
@ -62,6 +63,7 @@ public:
void addContext(Context context){m_contexts.push_back(context); updateKeyBindings();}
std::string getCurrentContext(){return m_current_context;}
void setCurrentContext(std::string context_name){m_current_context = context_name;}
std::vector<std::string> getContextsList();
void updateKeyBindings();
/* window-related function */

View File

@ -42,6 +42,7 @@ public:
enum {PRESSED, RELEASED, HOLD};
IKeysMap();
std::vector<Binding> getBindings(Action action) const;
std::vector<Binding>& data(){return keys;}
protected:
std::vector<Binding> keys;
};