added getCurrentContext()
This commit is contained in:
parent
f2856dcf63
commit
273e8cc7e6
@ -95,14 +95,18 @@ std::vector<int> Input::getActions()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* context-related functions */
|
/* context-related functions */
|
||||||
void Input::addContext(Context context)
|
|
||||||
{
|
|
||||||
m_contexts.push_back(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Input::setCurrentContext(std::string context_name){
|
//void Input::addContext(Context context)
|
||||||
m_current_context = context_name;
|
//{
|
||||||
}
|
// m_contexts.push_back(context);
|
||||||
|
//}
|
||||||
|
//std::string Input::getCurrentContext()
|
||||||
|
//{
|
||||||
|
// return m_current_context;
|
||||||
|
//}
|
||||||
|
//void Input::setCurrentContext(std::string context_name){
|
||||||
|
// m_current_context = context_name;
|
||||||
|
//}
|
||||||
|
|
||||||
void Input::updateKeyBindings(){
|
void Input::updateKeyBindings(){
|
||||||
m_keybindings.clear();
|
m_keybindings.clear();
|
||||||
|
61
src/input.h
61
src/input.h
@ -11,6 +11,33 @@
|
|||||||
#include "textbuffer.h"
|
#include "textbuffer.h"
|
||||||
|
|
||||||
class Input{
|
class Input{
|
||||||
|
private:
|
||||||
|
/* window-related variables */
|
||||||
|
sf::Window* m_window;
|
||||||
|
bool m_closeRequested;
|
||||||
|
bool m_hasBeenResized;
|
||||||
|
|
||||||
|
/* general action-mapping variables */
|
||||||
|
IKeysMap m_keysmap;
|
||||||
|
std::vector<int> m_actions;
|
||||||
|
int nb_actions;
|
||||||
|
|
||||||
|
/* context-related variables */
|
||||||
|
std::string m_current_context;
|
||||||
|
std::vector<Context> m_contexts;
|
||||||
|
std::unordered_map<std::string,KeyBindings> m_keybindings;
|
||||||
|
|
||||||
|
/* keyboard-related variables */
|
||||||
|
std::vector<sf::Keyboard::Key> m_heldkeys;
|
||||||
|
void releaseHeldKeys(sf::Keyboard::Key keycode);
|
||||||
|
|
||||||
|
/* mouse-related variables */
|
||||||
|
sf::Vector2i m_mouse_position;
|
||||||
|
sf::Vector2i m_last_mouse_position;
|
||||||
|
float m_delta_vertical_scroll;
|
||||||
|
|
||||||
|
/* text-related variable */
|
||||||
|
std::string m_buffer;
|
||||||
public:
|
public:
|
||||||
/* Constructors */
|
/* Constructors */
|
||||||
Input(sf::Window *w);
|
Input(sf::Window *w);
|
||||||
@ -21,8 +48,9 @@ class Input{
|
|||||||
std::vector<int> getActions(); //get the first action in the file of event
|
std::vector<int> getActions(); //get the first action in the file of event
|
||||||
|
|
||||||
/* context-related functions */
|
/* context-related functions */
|
||||||
void addContext(Context context);
|
void addContext(Context context){m_contexts.push_back(context);}
|
||||||
void setCurrentContext(std::string context_name);
|
std::string getCurrentContext(){return m_current_context;}
|
||||||
|
void setCurrentContext(std::string context_name){m_current_context = context_name;}
|
||||||
void updateKeyBindings();
|
void updateKeyBindings();
|
||||||
|
|
||||||
/* window-related function */
|
/* window-related function */
|
||||||
@ -41,35 +69,6 @@ class Input{
|
|||||||
std::string getText();
|
std::string getText();
|
||||||
|
|
||||||
void test();
|
void test();
|
||||||
|
|
||||||
private:
|
|
||||||
/* window-related variables */
|
|
||||||
sf::Window* m_window;
|
|
||||||
bool m_closeRequested;
|
|
||||||
bool m_hasBeenResized;
|
|
||||||
|
|
||||||
/* general action-mapping variables */
|
|
||||||
IKeysMap m_keysmap;
|
|
||||||
std::vector<int> m_actions;
|
|
||||||
int nb_actions;
|
|
||||||
|
|
||||||
/* context-related variables */
|
|
||||||
std::string m_current_context;
|
|
||||||
//std::unordered_map<std::string, std::vector<int>> contexts;
|
|
||||||
std::vector<Context> m_contexts;
|
|
||||||
std::unordered_map<std::string,KeyBindings> m_keybindings;
|
|
||||||
|
|
||||||
/* keyboard-related variables */
|
|
||||||
std::vector<sf::Keyboard::Key> m_heldkeys;
|
|
||||||
void releaseHeldKeys(sf::Keyboard::Key keycode);
|
|
||||||
|
|
||||||
/* mouse-related variables */
|
|
||||||
sf::Vector2i m_mouse_position;
|
|
||||||
sf::Vector2i m_last_mouse_position;
|
|
||||||
float m_delta_vertical_scroll;
|
|
||||||
|
|
||||||
/* text-related variable */
|
|
||||||
std::string m_buffer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //INPUT_H
|
#endif //INPUT_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user