Defines a system event and its parameters. More...
#include <SFML/Window/Event.hpp>
Classes | |
struct | JoystickButtonEvent |
Joystick buttons events parameters (JoystickButtonPressed, JoystickButtonReleased) More... | |
struct | JoystickConnectEvent |
Joystick connection events parameters (JoystickConnected, JoystickDisconnected) More... | |
struct | JoystickMoveEvent |
Joystick axis move event parameters (JoystickMoved) More... | |
struct | KeyEvent |
Keyboard event parameters (KeyPressed, KeyReleased) More... | |
struct | MouseButtonEvent |
Mouse buttons events parameters (MouseButtonPressed, MouseButtonReleased) More... | |
struct | MouseMoveEvent |
Mouse move event parameters (MouseMoved) More... | |
struct | MouseWheelEvent |
Mouse wheel events parameters (MouseWheelMoved) More... | |
struct | MouseWheelScrollEvent |
Mouse wheel events parameters (MouseWheelScrolled) More... | |
struct | SensorEvent |
Sensor event parameters (SensorChanged) More... | |
struct | SizeEvent |
Size events parameters (Resized) More... | |
struct | TextEvent |
Text event parameters (TextEntered) More... | |
struct | TouchEvent |
Touch events parameters (TouchBegan, TouchMoved, TouchEnded) More... | |
Public Types | |
enum | EventType { Closed , Resized , LostFocus , GainedFocus , TextEntered , KeyPressed , KeyReleased , MouseWheelMoved , MouseWheelScrolled , MouseButtonPressed , MouseButtonReleased , MouseMoved , MouseEntered , MouseLeft , JoystickButtonPressed , JoystickButtonReleased , JoystickMoved , JoystickConnected , JoystickDisconnected , TouchBegan , TouchMoved , TouchEnded , SensorChanged , Count } |
Enumeration of the different types of events. More... | |
Defines a system event and its parameters.
sf::Event holds all the informations about a system event that just happened.
Events are retrieved using the sf::Window::pollEvent and sf::Window::waitEvent functions.
A sf::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 KeyPressed event, then you must read the event.key member, all other members such as event.mouseMove or event.text will have undefined values.
Usage example:
enum sf::Event::EventType |
Enumeration of the different types of events.
JoystickButtonEvent sf::Event::joystickButton |
Joystick button event parameters (Event::JoystickButtonPressed, Event::JoystickButtonReleased)
JoystickConnectEvent sf::Event::joystickConnect |
Joystick (dis)connect event parameters (Event::JoystickConnected, Event::JoystickDisconnected)
JoystickMoveEvent sf::Event::joystickMove |
Joystick move event parameters (Event::JoystickMoved)
KeyEvent sf::Event::key |
Key event parameters (Event::KeyPressed, Event::KeyReleased)
MouseButtonEvent sf::Event::mouseButton |
Mouse button event parameters (Event::MouseButtonPressed, Event::MouseButtonReleased)
MouseMoveEvent sf::Event::mouseMove |
Mouse move event parameters (Event::MouseMoved)
MouseWheelEvent sf::Event::mouseWheel |
Mouse wheel event parameters (Event::MouseWheelMoved) (deprecated)
MouseWheelScrollEvent sf::Event::mouseWheelScroll |
Mouse wheel event parameters (Event::MouseWheelScrolled)
SensorEvent sf::Event::sensor |
Sensor event parameters (Event::SensorChanged)
SizeEvent sf::Event::size |
Size event parameters (Event::Resized)
TextEvent sf::Event::text |
Text event parameters (Event::TextEntered)
TouchEvent sf::Event::touch |
Touch events parameters (Event::TouchBegan, Event::TouchMoved, Event::TouchEnded)