#ifndef SPECTRE_INPUT_EVENT_H #define SPECTRE_INPUT_EVENT_H #include #include #include #include namespace sp { typedef struct InputEvent { enum Type { None, Key, MouseButton, MousePosition }; struct KeyEvent { Keyboard::Key code; bool pressed; /* true if pressed, false if released. */ std::string getKeyName() const; /* Get the key name */ }; struct MouseButtonEvent { Mouse::Button button; bool pressed; /* true if pressed, false if released. */ std::string getName() const; }; struct MouseEvent { unsigned int x; unsigned int y; }; Type type; union { struct KeyEvent key; struct MouseEvent mouse; struct MouseButtonEvent mouseButton; }; InputEvent(Type type = None); } InputEvent; } // namespace sp #endif /* SPECTRE_INPUT_EVENT_H */