Contents
This module provides input event classes. Input event objects are used to consolidate all necessary information about input events in a clean way.
You normally don’t need to use input event objects directly. Input events are handled automatically in each frame of the SGE’s main loop. You only need to use input event objects directly if you take control away from the SGE’s main loop, e.g. to create your own loop.
This input event represents a key on the keyboard being pressed.
The identifier string of the key that was pressed. See the table below.
The Unicode character associated with the key press, or an empty Unicode string if no Unicode character is associated with the key press. See the table below.
Key Name | Identifier String | Unicode Character |
---|---|---|
0 | "0" | "0" |
1 | "1" | "1" |
2 | "2" | "2" |
3 | "3" | "3" |
4 | "4" | "4" |
5 | "5" | "5" |
6 | "6" | "6" |
7 | "7" | "7" |
8 | "8" | "8" |
9 | "9" | "9" |
A | "a" | "a" |
B | "b" | "b" |
C | "c" | "c" |
D | "d" | "d" |
E | "e" | "e" |
F | "f" | "f" |
G | "g" | "g" |
H | "h" | "h" |
I | "i" | "i" |
J | "j" | "j" |
K | "k" | "k" |
L | "l" | "l" |
M | "m" | "m" |
N | "n" | "n" |
O | "o" | "o" |
P | "p" | "p" |
Q | "q" | "q" |
R | "r" | "r" |
S | "s" | "s" |
T | "t" | "t" |
U | "u" | "u" |
V | "v" | "v" |
W | "w" | "w" |
X | "x" | "x" |
Y | "y" | "y" |
Z | "z" | "z" |
Period | "period" | "." |
Comma | "comma" | "," |
Less Than | "less_than" | "<" |
Greater Than | "greater_than" | ">" |
Forward Slash | "slash" | "/" |
Question Mark | "question" | "?" |
Apostrophe | "apostrophe" | "'" |
Quotation Mark | "quote" | '"' |
Colon | "colon" | ":" |
Semicolon | "semicolon" | ";" |
Exclamation Point | "exclamation" | "!" |
At | "at" | "@" |
Hash | "hash" | "#" |
Dollar Sign | "dollar" | "$" |
Carat | "carat" | "^" |
Ampersand | "ampersand" | "&" |
Asterisk | "asterisk" | "*" |
Left Parenthesis | "parenthesis_left" | "(" |
Right Parenthesis | "parenthesis_right" | ")" |
Hyphen | "hyphen" | "-" |
Underscore | "underscore" | "_" |
Plus Sign | "plus" | "+" |
Equals Sign | "equals" | "=" |
Left Bracket | "bracket_left" | "[" |
Right Bracket | "bracket_right" | "]" |
Backslash | "backslash" | "\\" |
Backtick | "backtick" | "`" |
Euro | "euro" | "\u20ac" |
Keypad 0 | "kp_0" | "0" |
Keypad 1 | "kp_1" | "1" |
Keypad 2 | "kp_2" | "2" |
Keypad 3 | "kp_3" | "3" |
Keypad 4 | "kp_4" | "4" |
Keypad 5 | "kp_5" | "5" |
Keypad 6 | "kp_6" | "6" |
Keypad 7 | "kp_7" | "7" |
Keypad 8 | "kp_8" | "8" |
Keypad 9 | "kp_9" | "9" |
Keypad Decimal Point | "kp_point" | "." |
Keypad Plus | "kp_plus" | "+" |
Keypad Minus | "kp_minus" | "-" |
Keypad Multiply | "kp_multiply" | "*" |
Keypad Divide | "kp_divide" | "/" |
Keypad Equals | "kp_equals" | "=" |
Keypad Enter | "kp_enter" | "\n" |
Left Arrow | "left" | "" |
Right Arrow | "right" | "" |
Up Arrow | "up" | "" |
Down Arrow | "down" | "" |
Home | "home" | "" |
End | "end" | "" |
Page Up | "pageup" | "" |
Page Down | "pagedown" | "" |
Tab | "tab" | "\t" |
Space Bar | "space" | " " |
Enter/Return | "enter" | "\n" |
Backspace | "backspace" | "\b" |
Delete | "delete" | "" |
Clear | "clear" | "" |
Left Shift | "shift_left" | "" |
Right Shift | "shift_right" | "" |
Left Ctrl | "ctrl_left" | "" |
Right Ctrl | "ctrl_right" | "" |
Left Alt | "alt_left" | "" |
Right Alt | "alt_right" | "" |
Left Super | "super_left" | "" |
Right Super | "super_right" | "" |
Mode | "mode" | "" |
Menu | "menu" | "" |
Caps Lock | "caps_lock" | "" |
Esc | "escape" | "" |
Num Lock | "num_lock" | "" |
Scroll Lock | "scroll_lock" | "" |
Break | "break" | "" |
Insert | "insert" | "" |
Pause | "pause" | "" |
Power | "power" | "" |
Print Screen | "print_screen" | "" |
SysRq | "sysrq" | "" |
F1 | "f1" | "" |
F2 | "f2" | "" |
F3 | "f3" | "" |
F4 | "f4" | "" |
F5 | "f5" | "" |
F6 | "f6" | "" |
F7 | "f7" | "" |
F8 | "f8" | "" |
F9 | "f9" | "" |
F10 | "f10" | "" |
F11 | "f11" | "" |
F12 | "f12" | "" |
This input event represents a key on the keyboard being released.
The identifier string of the key that was released. See the table in the documentation for sge.input.KeyPress.
This input event represents the mouse being moved.
The horizontal relative movement of the mouse.
The vertical relative movement of the mouse.
This input event represents a mouse button being pressed.
The identifier string of the mouse button that was pressed. See the table below.
Mouse Button Name | Identifier String |
---|---|
Left mouse button | "left" |
Right mouse button | "right" |
Middle mouse button | "middle" |
Mouse wheel up | "wheel_up" |
Mouse wheel down | "wheel_down" |
Mouse wheel tilt left | "wheel_left" |
Mouse wheel tilt right | "wheel_right" |
This input event represents a mouse button being released.
The identifier string of the mouse button that was released. See the table in the documentation for sge.input.MouseButtonPress.
This input event represents a joystick axis moving.
The name of the joystick.
The number of the joystick, where 0 is the first joystick.
The number of the axis that moved, where 0 is the first axis on the joystick.
The tilt of the axis as a float from -1 to 1, where 0 is centered, -1 is all the way to the left or up, and 1 is all the way to the right or down.
This input event represents a joystick hat moving.
The name of the joystick.
The number of the joystick, where 0 is the first joystick.
The number of the hat that moved, where 0 is the first axis on the joystick.
The horizontal position of the hat, where 0 is centered, -1 is left, and 1 is right.
The vertical position of the hat, where 0 is centered, -1 is up, and 1 is down.
This input event represents a joystick trackball moving.
The name of the joystick.
The number of the joystick, where 0 is the first joystick.
The number of the trackball that moved, where 0 is the first trackball on the joystick.
The horizontal relative movement of the trackball.
The vertical relative movement of the trackball.
This input event represents a joystick button being pressed.
The name of the joystick.
The number of the joystick, where 0 is the first joystick.
The number of the button that was pressed, where 0 is the first button on the joystick.
This input event represents a joystick button being released.
The name of the joystick.
The number of the joystick, where 0 is the first joystick.
The number of the button that was released, where 0 is the first button on the joystick.
This input event represents the game window gaining keyboard focus. Keyboard focus is normally needed for keyboard input to be received.
Note
On some window systems, such as the one used by Windows, no distinction is made between keyboard and mouse focus, but on some other window systems, such as the X Window System, a distinction is made: one window can have keyboard focus while another has mouse focus. Be careful to observe the difference; failing to do so may result in annoying bugs, and you won’t notice these bugs if you are testing on a window manager that doesn’t recognize the difference.
This input event represents the game window losing keyboard focus. Keyboard focus is normally needed for keyboard input to be received.
Note
See the note in the documentation for sge.input.KeyboardFocusGain.
This input event represents the game window gaining mouse focus. Mouse focus is normally needed for mouse input to be received.
Note
See the note in the documentation for sge.input.KeyboardFocusGain.
This input event represents the game window losing mouse focus. Mouse focus is normally needed for mouse input to be received.
Note
See the note in the documentation for sge.input.KeyboardFocusGain.