diff --git a/src/input.cpp b/src/input.cpp index 76e56f6..ce979aa 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -95,14 +95,18 @@ std::vector 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(); diff --git a/src/input.h b/src/input.h index e47306c..30a2886 100644 --- a/src/input.h +++ b/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 getActions(); //get the first action in the file of event + /* general action-mapping variables */ + IKeysMap m_keysmap; + std::vector 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 m_contexts; + std::unordered_map m_keybindings; - /* window-related function */ - bool isCloseRequested() const; - bool isResized() const; + /* keyboard-related variables */ + std::vector 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 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 m_actions; - int nb_actions; + /* keyboard-related functions */ + bool isKeyPressed(int key) const; - /* context-related variables */ - std::string m_current_context; - //std::unordered_map> contexts; - std::vector m_contexts; - std::unordered_map m_keybindings; + /* mouse-related function */ + sf::Vector2i getPosition() const; + sf::Vector2i getDeltaPosition() const; + float getDeltaVerticalScroll() const; - /* keyboard-related variables */ - std::vector 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