Defines a system event and its parameters.
Event holds all the informations about a system event that just happened.
Events are retrieved using the pollEvent function.
A Event instance contains the type of the event (mouse moved, key pressed, window closed, ...) as well as the details about this particular event.
val window: Window = ???
val doSomethingWithTheNewSize: (Int, Int) => Unit = ???
for event <- window.pollEvent() do
event match
// Request for closing the window
case Event.Closed() => window.close()
// The escape key was pressed
case Event.KeyPressed(Keyboard.Key.Escape, _, _, _, _, _) => window.close()
// The window was resized
case Event.Resized(width, height) => doSomethingWithTheNewSize(width, height)
// etc...
case _ => ()
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Members list
Type members
Enum entries
The window requested to be closed
The window requested to be closed
Attributes
The window gained the focus
The window gained the focus
Attributes
A key was pressed
A key was pressed
Value parameters
- alt
-
Is the Alt key pressed?
- code
-
Code of the key that has been pressed.
- control
-
Is the Control key pressed?
- scancode
-
Physical code of the key that has been pressed.
- shift
-
Is the Shift key pressed?
- system
-
Is the System key pressed?
Attributes
- Companion
- object
A key was released
A key was released
Value parameters
- alt
-
Is the Alt key released?
- code
-
Code of the key that has been released.
- control
-
Is the Control key released?
- scancode
-
Physical code of the key that has been released.
- shift
-
Is the Shift key released?
- system
-
Is the System key released?
Attributes
- Companion
- object
The window lost the focus
The window lost the focus
Attributes
A mouse button was pressed
A mouse button was pressed
Value parameters
- button
-
Code of the button that has been pressed.
- x
-
X position of the mouse pointer, relative to the left of the owner window.
- y
-
Y position of the mouse pointer, relative to the top of the owner window.
Attributes
- Companion
- object
A mouse button was released
A mouse button was released
Value parameters
- button
-
Code of the button that has been released.
- x
-
X position of the mouse pointer, relative to the left of the owner window.
- y
-
Y position of the mouse pointer, relative to the top of the owner window.
Attributes
- Companion
- object
The mouse cursor entered the area of the window
The mouse cursor entered the area of the window
Attributes
The mouse cursor left the area of the window
The mouse cursor left the area of the window
Attributes
The mouse cursor moved
The mouse cursor moved
Value parameters
- x
-
X position of the mouse pointer, relative to the left of the owner window.
- y
-
Y position of the mouse pointer, relative to the top of the owner window.
Attributes
- Companion
- object
The mouse wheel was scrolled
The mouse wheel was scrolled
Value parameters
- delta
-
Wheel offset (positive is up/left, negative is down/right). High-precision mice may use non-integral offsets.
- wheel
-
Which wheel (for mice with multiple ones).
- x
-
X position of the mouse pointer, relative to the left of the owner window.
- y
-
Y position of the mouse pointer, relative to the top of the owner window.
Attributes
- Companion
- object
The window was resized
The window was resized
Value parameters
- height
-
New height, in pixels.
- width
-
New width, in pixels.
Attributes
- Companion
- object
Attributes
- Companion
- object
A character was entered
A character was entered
Value parameters
- unicode
-
UTF-32 Unicode value of the character.
Attributes
- Companion
- object
A touch event began
A touch event began
Value parameters
- finger
-
Index of the finger in case of multi-touch events.
- x
-
X position of the touch, relative to the left of the owner window.
- y
-
Y position of the touch, relative to the top of the owner window.
Attributes
- Companion
- object
A touch event ended
A touch event ended
Value parameters
- finger
-
Index of the finger in case of multi-touch events.
- x
-
X position of the touch, relative to the left of the owner window.
- y
-
Y position of the touch, relative to the top of the owner window.
Attributes
- Companion
- object
A touch moved
A touch moved
Value parameters
- finger
-
Index of the finger in case of multi-touch events.
- x
-
X position of the touch, relative to the left of the owner window.
- y
-
Y position of the touch, relative to the top of the owner window.
Attributes
- Companion
- object