1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #ifndef DEF_INPUT
- #define DEF_INPUT
- ///Jovian
- ///Centralisation du traitement d'évènement
- // Include
- #include <set>
- #include <SDL2/SDL.h>
- class Input {
- /// Methods
- public:
- Input();
- virtual ~Input();
- virtual void updateEvents();
- protected: // Deal with an event, return true if caught
- bool catchKeyBoardEvents(const SDL_Event &event);
- bool catchMouseEvents(const SDL_Event &event);
- bool catchWindowEvents(const SDL_Event &event);
- public:
- bool isFinished() const;
- void showCursor(bool flag) const;
- void capPtr(bool flag);
- bool getKey(const SDL_Scancode key) const;
- bool getInstantKey(const SDL_Scancode key) const;
- bool getMouseKey(const Uint8 key) const;
- bool isMouseMoving() const;
- int getX() const;
- int getY() const;
- int getXFromCenter();
- int getYFromCenter();
- int getXRel() const;
- int getYRel() const;
- void setWindow(SDL_Window *activWindow);
- /// Variables
- protected:
- SDL_Event m_event;
- bool m_keys[SDL_NUM_SCANCODES];
- std::set<SDL_Scancode> m_instantKeys;
- bool m_mouseKeys[8];
- int m_x;
- int m_y;
- int m_xRel;
- int m_yRel;
- bool m_finished;
- bool m_relativeMouse;
- SDL_Window *m_window;
- int m_windowHalfHeight;
- int m_windowHalfWidth;
- };
- #endif
|