LWXGL dispatches keyboard, mouse, and window-close events to user-supplied callbacks registered with theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/dRessedAlarm184/LWXGL/llms.txt
Use this file to discover all available pages before exploring further.
GEventAttach* functions. Each function stores a single function pointer; calling the same attach function twice replaces the previous callback. All callbacks are invoked from within GHandleWindowEvents, which must be called each frame (either directly or via GSimpleWindowLoop).
GEventAttachKey
Function called on key-press.
key is the ASCII value of printable characters, or one of the LWXGL key constants for special keys.LWXGL key constants:| Constant | Value | Key |
|---|---|---|
LWXGL_KEY_LEFT | 170 | Left arrow |
LWXGL_KEY_RIGHT | 171 | Right arrow |
LWXGL_KEY_UP | 172 | Up arrow |
LWXGL_KEY_DOWN | 173 | Down arrow |
LWXGL_KEY_FN + 1 through LWXGL_KEY_FN + 12 | 151–162 | F1–F12 |
LWXGL_KEY_FN is defined as 150; function key Fn maps to LWXGL_KEY_FN + n.- A modal dialog is currently open (
GQueryModalOpen()returns1). - The cursor is inside a focused input element, which consumes printable characters and Backspace.
- The cursor is inside a console element and the key is Space (which scrolls the console to the bottom).
F12 is reserved by
GSimpleWindowLoop to toggle the debug overlay and is never forwarded to the key callback.
Ctrl+Escape triggers GDeleteWindow and is also not forwarded.GEventAttachClick
Function called on mouse button release.
x,y— cursor position in window coordinates at the time of release.btn— button identifier:
| Value | Button |
|---|---|
1 | Left |
2 | Middle |
3 | Right |
4 | Scroll up |
5 | Scroll down |
- A modal dialog is currently open.
- The release lands inside a button widget (button’s
onclickis called instead and event propagation stops). - The release lands inside a checkbox widget (its checked state is toggled instead).
- The release lands inside a console widget with scroll buttons 4 or 5 (the console scrolls instead).
GEventAttachDelete
GDeleteWindow is called programmatically).
Function called when a window-close is requested. Return
1 to allow the window to close; return 0 to cancel and keep the window open. If this callback is not registered, close always proceeds immediately.