added getCurrentContext()
This commit is contained in:
parent
f2856dcf63
commit
273e8cc7e6
@ -95,14 +95,18 @@ std::vector<int> Input::getActions()
|
||||
}
|
||||
|
||||
/* context-related functions */
|
||||
void Input::addContext(Context context)
|
||||
{
|
||||
m_contexts.push_back(context);
|
||||
}
|
||||
|
||||
void Input::setCurrentContext(std::string context_name){
|
||||
m_current_context = context_name;
|
||||
}
|
||||
//void Input::addContext(Context context)
|
||||
//{
|
||||
// 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(){
|
||||
m_keybindings.clear();
|
||||
|
93
src/input.h
93
src/input.h
@ -11,65 +11,64 @@
|
||||
#include "textbuffer.h"
|
||||
|
||||
class Input{
|
||||
public:
|
||||
/* Constructors */
|
||||
Input(sf::Window *w);
|
||||
private:
|
||||
/* window-related variables */
|
||||
sf::Window* m_window;
|
||||
bool m_closeRequested;
|
||||
bool m_hasBeenResized;
|
||||
|
||||
/* general action-mapping functions */
|
||||
void setKeysMap(IKeysMap km); //set bindings
|
||||
void updateEvents(); //handle the input and put the associated event in the file
|
||||
std::vector<int> getActions(); //get the first action in the file of event
|
||||
/* general action-mapping variables */
|
||||
IKeysMap m_keysmap;
|
||||
std::vector<int> m_actions;
|
||||
int nb_actions;
|
||||
|
||||
/* context-related functions */
|
||||
void addContext(Context context);
|
||||
void setCurrentContext(std::string context_name);
|
||||
void updateKeyBindings();
|
||||
/* context-related variables */
|
||||
std::string m_current_context;
|
||||
std::vector<Context> m_contexts;
|
||||
std::unordered_map<std::string,KeyBindings> m_keybindings;
|
||||
|
||||
/* window-related function */
|
||||
bool isCloseRequested() const;
|
||||
bool isResized() const;
|
||||
/* keyboard-related variables */
|
||||
std::vector<sf::Keyboard::Key> m_heldkeys;
|
||||
void releaseHeldKeys(sf::Keyboard::Key keycode);
|
||||
|
||||
/* keyboard-related functions */
|
||||
bool isKeyPressed(int key) const;
|
||||
/* mouse-related variables */
|
||||
sf::Vector2i m_mouse_position;
|
||||
sf::Vector2i m_last_mouse_position;
|
||||
float m_delta_vertical_scroll;
|
||||
|
||||
/* mouse-related function */
|
||||
sf::Vector2i getPosition() const;
|
||||
sf::Vector2i getDeltaPosition() const;
|
||||
float getDeltaVerticalScroll() const;
|
||||
/* text-related variable */
|
||||
std::string m_buffer;
|
||||
public:
|
||||
/* Constructors */
|
||||
Input(sf::Window *w);
|
||||
|
||||
/* text-related function */
|
||||
std::string getText();
|
||||
/* general action-mapping functions */
|
||||
void setKeysMap(IKeysMap km); //set bindings
|
||||
void updateEvents(); //handle the input and put the associated event in the file
|
||||
std::vector<int> getActions(); //get the first action in the file of event
|
||||
|
||||
void test();
|
||||
/* context-related functions */
|
||||
void addContext(Context context){m_contexts.push_back(context);}
|
||||
std::string getCurrentContext(){return m_current_context;}
|
||||
void setCurrentContext(std::string context_name){m_current_context = context_name;}
|
||||
void updateKeyBindings();
|
||||
|
||||
private:
|
||||
/* window-related variables */
|
||||
sf::Window* m_window;
|
||||
bool m_closeRequested;
|
||||
bool m_hasBeenResized;
|
||||
/* window-related function */
|
||||
bool isCloseRequested() const;
|
||||
bool isResized() const;
|
||||
|
||||
/* general action-mapping variables */
|
||||
IKeysMap m_keysmap;
|
||||
std::vector<int> m_actions;
|
||||
int nb_actions;
|
||||
/* keyboard-related functions */
|
||||
bool isKeyPressed(int key) const;
|
||||
|
||||
/* 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;
|
||||
/* mouse-related function */
|
||||
sf::Vector2i getPosition() const;
|
||||
sf::Vector2i getDeltaPosition() const;
|
||||
float getDeltaVerticalScroll() const;
|
||||
|
||||
/* keyboard-related variables */
|
||||
std::vector<sf::Keyboard::Key> m_heldkeys;
|
||||
void releaseHeldKeys(sf::Keyboard::Key keycode);
|
||||
/* text-related function */
|
||||
std::string getText();
|
||||
|
||||
/* 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;
|
||||
void test();
|
||||
};
|
||||
|
||||
#endif //INPUT_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user