added some functions for manipulation of sparrowinput by engine
This commit is contained in:
parent
36a0b7c380
commit
527f63522f
@ -202,7 +202,16 @@ std::vector<Action> Input::getActions()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* context-related functions */
|
/* 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();
|
m_keybindings.clear();
|
||||||
for (auto iter= m_contexts.begin(); iter != m_contexts.end(); ++iter)
|
for (auto iter= m_contexts.begin(); iter != m_contexts.end(); ++iter)
|
||||||
m_keybindings[iter->getName()]= KeyBindings(*iter,m_keysmap);
|
m_keybindings[iter->getName()]= KeyBindings(*iter,m_keysmap);
|
||||||
|
@ -55,6 +55,7 @@ public:
|
|||||||
|
|
||||||
/* general action-mapping functions */
|
/* general action-mapping functions */
|
||||||
void setKeysMap(IKeysMap km); //set bindings
|
void setKeysMap(IKeysMap km); //set bindings
|
||||||
|
IKeysMap getKeysMap(){return m_keysmap;}
|
||||||
void updateEvents(); //handle the input and put the associated event in the file
|
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
|
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();}
|
void addContext(Context context){m_contexts.push_back(context); updateKeyBindings();}
|
||||||
std::string getCurrentContext(){return m_current_context;}
|
std::string getCurrentContext(){return m_current_context;}
|
||||||
void setCurrentContext(std::string context_name){m_current_context = context_name;}
|
void setCurrentContext(std::string context_name){m_current_context = context_name;}
|
||||||
|
std::vector<std::string> getContextsList();
|
||||||
void updateKeyBindings();
|
void updateKeyBindings();
|
||||||
|
|
||||||
/* window-related function */
|
/* window-related function */
|
||||||
|
@ -42,6 +42,7 @@ public:
|
|||||||
enum {PRESSED, RELEASED, HOLD};
|
enum {PRESSED, RELEASED, HOLD};
|
||||||
IKeysMap();
|
IKeysMap();
|
||||||
std::vector<Binding> getBindings(Action action) const;
|
std::vector<Binding> getBindings(Action action) const;
|
||||||
|
std::vector<Binding> data(){return keys;}
|
||||||
protected:
|
protected:
|
||||||
std::vector<Binding> keys;
|
std::vector<Binding> keys;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user