306 template <
typename TEventSubtype>
307 Event(
const TEventSubtype& eventSubtype);
317 template <
typename TEventSubtype>
318 [[nodiscard]]
bool is()
const;
328 template <
typename TEventSubtype>
329 [[nodiscard]]
const TEventSubtype*
getIf()
const;
339 template <
typename Visitor>
340 decltype(
auto)
visit(Visitor&& visitor)
const;
374 template <
typename T,
typename... Ts>
375 [[nodiscard]]
static constexpr bool isInParameterPack(
const std::variant<Ts...>*)
377 return std::disjunction_v<std::is_same<T, Ts>...>;
380 template <
typename T>
381 static constexpr bool isEventSubtype = isInParameterPack<T>(
decltype (&m_data)(
nullptr));
385 template <
typename Handler,
typename... Ts>
386 [[nodiscard]]
static constexpr bool isInvocableWithEventSubtype(
const std::variant<Ts...>*)
388 return std::disjunction_v<std::is_invocable<Handler&, Ts&>...>;
391 template <
typename Handler>
392 static constexpr bool isEventHandler = isInvocableWithEventSubtype<Handler>(
decltype (&m_data)(
nullptr));
397#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(Visitor &&visitor) const
Apply a visitor to the event.
Axis
Axes supported by SFML joysticks.
Vector3< float > Vector3f
Vector2< unsigned int > Vector2u
Gained focus event subtype.
Lost focus event subtype.
Joystick connected event subtype.
unsigned int joystickId
Index of the joystick (in range [0 .. Joystick::Count - 1])
Joystick disconnected event subtype.
unsigned int joystickId
Index of the joystick (in range [0 .. Joystick::Count - 1])
Joystick axis move event subtype.
unsigned int joystickId
Index of the joystick (in range [0 .. Joystick::Count - 1])
Joystick::Axis axis
Axis on which the joystick moved.
float position
New position on the axis (in range [-100 .. 100])
Key pressed event subtype.
bool system
Is the System key pressed?
bool control
Is the Control key pressed?
bool shift
Is the Shift key pressed?
bool alt
Is the Alt key pressed?
Keyboard::Key code
Code of the key that has been pressed.
Keyboard::Scancode scancode
Physical code of the key that has been pressed.
Key released event subtype.
bool alt
Is the Alt key pressed?
bool control
Is the Control key pressed?
bool shift
Is the Shift key pressed?
bool system
Is the System key pressed?
Keyboard::Key code
Code of the key that has been released.
Keyboard::Scancode scancode
Physical code of the key that has been released.
Mouse entered event subtype.
Mouse left event subtype.
Mouse move raw event subtype.
Vector2i delta
Delta movement of the mouse since the last event.
Mouse move event subtype.
Vector2i position
Position of the mouse pointer, relative to the top left of the owner window.
Vector2u size
New size, in pixels.
Sensor::Type type
Type of the sensor.
Vector3f value
Current value of the sensor on the X, Y, and Z axes.
char32_t unicode
UTF-32 Unicode value of the character.
Touch began event subtype.
Vector2i position
Start position of the touch, relative to the top left of the owner window.
unsigned int finger
Index of the finger in case of multi-touch events.
Touch ended event subtype.
Vector2i position
Final position of the touch, relative to the top left of the owner window.
unsigned int finger
Index of the finger in case of multi-touch events.
Touch moved event subtype.
Vector2i position
Current position of the touch, relative to the top left of the owner window.
unsigned int finger
Index of the finger in case of multi-touch events.