View on GitHub

DSFML

dsfml.window.event

A module containing the Event struct and other event structs.

struct Event;
Defines a system event and its parameters.

Event holds all the informations about a system event that just happened.

Events are retrieved using the sWindow.pollEvent and Window.waitEvent functions.

A 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.

struct JoystickButtonEvent;
Joystick buttons events parameters (JoystickButtonPressed, JoystickButtonReleased)

uint joystickId;
Index of the joystick (in range [0 .. Joystick::Count - 1])

uint button;
Index of the button that has been pressed (in range [0 .. Joystick::ButtonCount - 1])

struct JoystickConnectEvent;
Joystick connection events parameters (JoystickConnected, JoystickDisconnected)

uint joystickId;
Index of the joystick (in range [0 .. Joystick::Count - 1])

struct JoystickMoveEvent;
Joystick connection events parameters (JoystickConnected, JoystickDisconnected)

uint joystickId;
Index of the joystick (in range [0 .. Joystick::Count - 1])

int axis;
Axis on which the joystick moved

float position;
New position on the axis (in range [-100 .. 100])

struct KeyEvent;
Keyboard event parameters (KeyPressed, KeyReleased)

Keyboard.Key code;
Code of the key that has been pressed.

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?

struct MouseButtonEvent;
Mouse buttons events parameters (MouseButtonPressed, MouseButtonReleased)

Mouse.Button button;
Code of the button that has been pressed

int x;
X position of the mouse pointer, relative to the left of the owner window

int y;
Y position of the mouse pointer, relative to the top of the owner window

struct MouseMoveEvent;
Mouse move event parameters (MouseMoved)

int x;
X position of the mouse pointer, relative to the left of the owner window

int y;
Y position of the mouse pointer, relative to the top of the owner window

struct MouseWheelEvent;
Mouse wheel events parameters (MouseWheelMoved)

int delta;
Number of ticks the wheel has moved (positive is up, negative is down)

int x;
X position of the mouse pointer, relative to the left of the owner window

int y;
Y position of the mouse pointer, relative to the top of the owner window

struct SizeEvent;
Size events parameters (Resized)

uint width;
New width, in pixels

uint height;
New height, in pixels

struct TextEvent;
Text event parameters (TextEntered)

dchar unicode;
UTF-32 unicode value of the character

EventType type;
Type of the event

SizeEvent size;
Size event parameters (Event::Resized)

KeyEvent key;
Key event parameters (Event::KeyPressed, Event::KeyReleased)

TextEvent text;
Text event parameters (Event::TextEntered)

MouseMoveEvent mouseMove;
Mouse move event parameters (Event::MouseMoved)

MouseButtonEvent mouseButton;
Mouse button event parameters (Event::MouseButtonPressed, Event::MouseButtonReleased)

MouseWheelEvent mouseWheel;
Mouse wheel event parameters (Event::MouseWheelMoved)

JoystickMoveEvent joystickMove;
Joystick move event parameters (Event::JoystickMoved)

JoystickButtonEvent joystickButton;
Joystick button event parameters (Event::JoystickButtonPressed, Event::JoystickButtonReleased)

JoystickConnectEvent joystickConnect;
Joystick (dis)connect event parameters (Event::JoystickConnected, Event::JoystickDisconnected)