305 template <
typename TEventSubtype>
306 Event(
const TEventSubtype& eventSubtype);
316 template <
typename TEventSubtype>
317 [[nodiscard]]
bool is()
const;
327 template <
typename TEventSubtype>
328 [[nodiscard]]
const TEventSubtype*
getIf()
const;
338 template <
typename T>
339 decltype(
auto)
visit(T&& visitor)
const;
373 template <
typename T,
typename... Ts>
374 [[nodiscard]]
static constexpr bool isInParameterPack(
const std::variant<Ts...>*)
376 return (std::is_same_v<T, Ts> || ...);
379 template <
typename T>
380 static constexpr bool isEventSubtype = isInParameterPack<T>(
decltype (&m_data)(
nullptr));
385#include <SFML/Window/Event.inl>
const TEventSubtype * getIf() const
Attempt to get specified event subtype.
bool is() const
Check current event subtype.
Event(const TEventSubtype &eventSubtype)
Construct from a given sf::Event subtype.
decltype(auto) visit(T &&visitor) const
Apply a visitor to the event.
Axis
Axes supported by SFML joysticks.
Definition Joystick.hpp:55
Scan Scancode
Definition Keyboard.hpp:329
Key
Key codes.
Definition Keyboard.hpp:52
Button
Mouse buttons.
Definition Mouse.hpp:50
Wheel
Mouse wheels.
Definition Mouse.hpp:66
Type
Sensor type.
Definition Sensor.hpp:45
Definition BlendMode.hpp:34
Vector3< float > Vector3f
Definition Vector3.hpp:313
Vector2< unsigned int > Vector2u
Definition Vector2.hpp:225
Vector2< int > Vector2i
Definition Vector2.hpp:224
Closed event subtype.
Definition Event.hpp:54
Gained focus event subtype.
Definition Event.hpp:79
Lost focus event subtype.
Definition Event.hpp:71
Joystick connected event subtype.
Definition Event.hpp:244
unsigned int joystickId
Index of the joystick (in range [0 .. Joystick::Count - 1]).
Definition Event.hpp:245
Joystick disconnected event subtype.
Definition Event.hpp:253
unsigned int joystickId
Index of the joystick (in range [0 .. Joystick::Count - 1]).
Definition Event.hpp:254
Joystick axis move event subtype.
Definition Event.hpp:233
unsigned int joystickId
Index of the joystick (in range [0 .. Joystick::Count - 1]).
Definition Event.hpp:234
Joystick::Axis axis
Axis on which the joystick moved.
Definition Event.hpp:235
float position
New position on the axis (in range [-100 .. 100]).
Definition Event.hpp:236
Key pressed event subtype.
Definition Event.hpp:96
bool system
Is the System key pressed?
Definition Event.hpp:102
bool control
Is the Control key pressed?
Definition Event.hpp:100
bool shift
Is the Shift key pressed?
Definition Event.hpp:101
bool alt
Is the Alt key pressed?
Definition Event.hpp:99
Keyboard::Key code
Code of the key that has been pressed.
Definition Event.hpp:97
Keyboard::Scancode scancode
Physical code of the key that has been pressed.
Definition Event.hpp:98
Key released event subtype.
Definition Event.hpp:110
bool alt
Is the Alt key pressed?
Definition Event.hpp:113
bool control
Is the Control key pressed?
Definition Event.hpp:114
bool shift
Is the Shift key pressed?
Definition Event.hpp:115
bool system
Is the System key pressed?
Definition Event.hpp:116
Keyboard::Key code
Code of the key that has been released.
Definition Event.hpp:111
Keyboard::Scancode scancode
Physical code of the key that has been released.
Definition Event.hpp:112
Mouse entered event subtype.
Definition Event.hpp:197
Mouse left event subtype.
Definition Event.hpp:205
Mouse move event subtype.
Definition Event.hpp:155
Vector2i position
Position of the mouse pointer, relative to the top left of the owner window.
Definition Event.hpp:156
Mouse move raw event subtype.
Definition Event.hpp:188
Vector2i delta
Delta movement of the mouse since the last event.
Definition Event.hpp:189
Resized event subtype.
Definition Event.hpp:62
Vector2u size
New size, in pixels.
Definition Event.hpp:63
Sensor event subtype.
Definition Event.hpp:292
Sensor::Type type
Type of the sensor.
Definition Event.hpp:293
Vector3f value
Current value of the sensor on the X, Y, and Z axes.
Definition Event.hpp:294
Text event subtype.
Definition Event.hpp:87
std::uint32_t unicode
UTF-32 Unicode value of the character.
Definition Event.hpp:88
Touch began event subtype.
Definition Event.hpp:262
Vector2i position
Start position of the touch, relative to the top left of the owner window.
Definition Event.hpp:264
unsigned int finger
Index of the finger in case of multi-touch events.
Definition Event.hpp:263
Touch ended event subtype.
Definition Event.hpp:282
Vector2i position
Final position of the touch, relative to the top left of the owner window.
Definition Event.hpp:284
unsigned int finger
Index of the finger in case of multi-touch events.
Definition Event.hpp:283
Touch moved event subtype.
Definition Event.hpp:272
Vector2i position
Current position of the touch, relative to the top left of the owner window.
Definition Event.hpp:274
unsigned int finger
Index of the finger in case of multi-touch events.
Definition Event.hpp:273