LWXGL supports a single modal dialog overlay that is rendered on top of all other elements. While a modal is open the event system returns early from button and input handling — clicks on buttons and keystrokes into input fields are suppressed — so the modal acts as a true blocking layer. Two types are supported: OK-only (typeDocumentation 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.
0) and OK/Cancel (type 1).
Spawning a Modal
| Parameter | Description |
|---|---|
type | 0 for an OK-only dialog; 1 for an OK/Cancel dialog. |
msg | Message text displayed inside the dialog. Supports \n for explicit line breaks. Lines are also soft-wrapped at approximately 31 characters. |
on_confirm | Called when the user clicks OK. Pass NULL if no action is needed on confirm. |
1 only) dismisses the modal without calling on_confirm.
Example — save confirmation dialog
Checking Modal State
1 if a modal is currently visible, 0 otherwise. This is useful in event handlers and frame callbacks to avoid triggering secondary actions while the user is interacting with a dialog.
Example — guard a button callback
GQueryModalOpen inside the per-frame callback to pause game logic, hide animated overlays, or prevent canvas updates while the modal is on screen:
Modal Appearance
The modal is rendered by the internalDrawActiveModal function as a centered 306 × 156 px box with a black fill and a one-pixel white border. Message text is drawn in white starting near the top of the box, left-aligned with a small margin.
- The OK label is rendered in green (palette index 10) near the bottom-right of the dialog.
- The Cancel label (type
1only) is rendered in red (palette index 12) to the left of OK.