dsfml.window.event

$(U Event) holds all the informations about a system event that just happened. Events are retrieved using the Window.pollEvent and Window.waitEvent functions. * An $(U 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. *

Members

Structs

Event
struct Event

Defines a system event and its parameters.

Examples

1 Event event;
2 while (window.pollEvent(event))
3 {
4    // Request for closing the window
5    if (event.type == Event.EventType.Closed)
6        window.close();
7  *
8    // The escape key was pressed
9    if ((event.type == Event.EventType.KeyPressed) && (event.key.code == Keyboard.Key.Escape))
10        window.close();
11  *
12    // The window was resized
13    if (event.type == Event.EventType.Resized)
14        doSomethingWithTheNewSize(event.size.width, event.size.height);
15  *
16    // etc ...
17 }

Meta