Gamedev Framework (gf)
0.3.0
A C++11 framework for 2D games
|
Defines a system event and its parameters. More...
#include <gf/Event.h>
Classes | |
struct | GamepadAxisEvent |
Gamepad axis event parameters (EventType::GamepadAxisMoved) More... | |
struct | GamepadButtonEvent |
Gamepad button event parameters (EventType::GamepadButtonPressed, EventType::GamepadButtonReleased) More... | |
struct | GamepadConnection |
Gamepad connection event parameters (EventType::GamepadConnected) More... | |
struct | GamepadDisconnection |
Gamepad disconnection event parameters (EventType::GamepadDisconnected) More... | |
struct | KeyEvent |
Keyboard event parameters (EventType::KeyPressed, EventType::KeyReleased, EventType::KeyRepeated) More... | |
struct | MouseButtonEvent |
Mouse button event parameters (EventType::MouseButtonPressed, EventType::MouseButtonReleased) More... | |
struct | MouseCursorEvent |
Mouse cursor move event parameters (EventType::MouseMoved) More... | |
struct | MouseWheelEvent |
Mouse wheel event parameters (EventType::MouseWheelScrolled) More... | |
struct | TextEvent |
Text event parameters (EventType::TextEntered) More... | |
Defines a system event and its parameters.
gf::Event holds all the informations about a system event that just happened. Events are retrieved using the gf::Window::pollEvent()
and gf::Window::waitEvent()
functions.
A gf::Event instance contains the type of the event (mouse moved, key pressed, window closed, ...) as well as the details about this particular event. Please note that the event parameters are defined in a union, which means that only the member matching the type of the event will be properly filled; all other members will have undefined values and must not be read if the type of the event doesn't match. For example, if you received a KeyType::KeyPressed event, then you must read the event.key
member, all other members such as event.mouse
or event.text
will have undefined values.
Usage example:
union { ... } |
GamepadAxisEvent gf::Event::gamepadAxis |
Gamepad axis event parameters (EventType::GamepadAxisMoved)
GamepadButtonEvent gf::Event::gamepadButton |
Gamepad button event parameters (EventType::GamepadButtonPressed, EventType::GamepadButtonReleased)
GamepadConnection gf::Event::gamepadConnection |
Gamepad connection event parameters (EventType::GamepadConnected)
GamepadDisconnection gf::Event::gamepadDisconnection |
Gamepad disconnection event parameters (EventType::GamepadDisconnected)
KeyEvent gf::Event::key |
Key event parameters (EventType::KeyPressed, EventType::KeyReleased, EventType::KeyRepeated)
MouseButtonEvent gf::Event::mouseButton |
Mouse button event parameters (EventType::MouseButtonPressed, EventType::MouseButtonReleased)
MouseCursorEvent gf::Event::mouseCursor |
Mouse cursor move event parameters (EventType::MouseMoved)
MouseWheelEvent gf::Event::mouseWheel |
Mouse wheel event parameters (EventType::MouseWheelScrolled)
Vector2u gf::Event::size |
Size event parameters (EventType::Resized)
EventType gf::Event::type |
Type of the event.