Defines a system event and its parameters. More...
#include <SFML/Window/Event.hpp>
Classes | |
| struct | Closed |
| Closed event subtype. More... | |
| struct | FocusGained |
| Gained focus event subtype. More... | |
| struct | FocusLost |
| Lost focus event subtype. More... | |
| struct | JoystickButtonPressed |
| Joystick button pressed event subtype. More... | |
| struct | JoystickButtonReleased |
| Joystick button released event subtype. More... | |
| struct | JoystickConnected |
| Joystick connected event subtype. More... | |
| struct | JoystickDisconnected |
| Joystick disconnected event subtype. More... | |
| struct | JoystickMoved |
| Joystick axis move event subtype. More... | |
| struct | KeyPressed |
| Key pressed event subtype. More... | |
| struct | KeyReleased |
| Key released event subtype. More... | |
| struct | MouseButtonPressed |
| Mouse button pressed event subtype. More... | |
| struct | MouseButtonReleased |
| Mouse button released event subtype. More... | |
| struct | MouseEntered |
| Mouse entered event subtype. More... | |
| struct | MouseLeft |
| Mouse left event subtype. More... | |
| struct | MouseMoved |
| Mouse move event subtype. More... | |
| struct | MouseMovedRaw |
| Mouse move raw event subtype. More... | |
| struct | MouseWheelScrolled |
| Mouse wheel scrolled event subtype. More... | |
| struct | Resized |
| Resized event subtype. More... | |
| struct | SensorChanged |
| Sensor event subtype. More... | |
| struct | TextEntered |
| Text event subtype. More... | |
| struct | TouchBegan |
| Touch began event subtype. More... | |
| struct | TouchEnded |
| Touch ended event subtype. More... | |
| struct | TouchMoved |
| Touch moved event subtype. More... | |
Public Member Functions | |
| template<typename TEventSubtype> | |
| Event (const TEventSubtype &eventSubtype) | |
Construct from a given sf::Event subtype. | |
| template<typename TEventSubtype> | |
| bool | is () const |
| Check current event subtype. | |
| template<typename TEventSubtype> | |
| const TEventSubtype * | getIf () const |
| Attempt to get specified event subtype. | |
| template<typename Visitor> | |
| decltype(auto) | visit (Visitor &&visitor) const |
| Apply a visitor to the event. | |
Friends | |
| class | WindowBase |
Detailed Description
Defines a system event and its parameters.
sf::Event holds all the information 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 subtype of the event (mouse moved, key pressed, window closed, ...) as well as the details about this particular event. Each event corresponds to a different subtype struct which contains the data required to process that event.
Event subtypes are event types belonging to sf::Event, such as sf::Event::Closed or sf::Event::MouseMoved.
The way to access the current active event subtype is via sf::Event::getIf. This member function returns the address of the event subtype struct if the event subtype matches the active event, otherwise it returns nullptr.
sf::Event::is is used to check the active event subtype without actually reading any of the corresponding event data.
Constructor & Destructor Documentation
◆ Event()
| sf::Event::Event | ( | const TEventSubtype & | eventSubtype | ) |
Member Function Documentation
◆ getIf()
|
nodiscard |
Attempt to get specified event subtype.
- Template Parameters
-
`TEventSubtype` Type of the desired event subtype
- Returns
- Address of current event subtype, otherwise
nullptr
◆ is()
|
nodiscard |
Check current event subtype.
- Template Parameters
-
`TEventSubtype` Type of the event subtype to check against
- Returns
trueif the current event subtype matches given template parameter
◆ visit()
| decltype(auto) sf::Event::visit | ( | Visitor && | visitor | ) | const |
Apply a visitor to the event.
- Parameters
-
visitor The visitor to apply
- Returns
- The result of applying the visitor to the event
Friends And Related Symbol Documentation
◆ WindowBase
|
friend |
The documentation for this class was generated from the following file: