LWXGL has two built-in overlay features: modal dialogs that block normal widget interaction while they are visible, and a debug overlay that shows real-time performance metrics during development.Documentation 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.
Modal Dialogs
type | Buttons shown |
|---|---|
0 | OK only (info dialog) |
1 | OK + Cancel (confirm dialog) |
msg is the message string displayed inside the dialog. It supports \n for line breaks; each line is rendered with the built-in 9×15 font, so keep lines to roughly 31 characters or fewer to fit within the dialog box.
on_confirm is a void callback invoked when the user clicks OK. Pass NULL to have OK simply dismiss the dialog. The Cancel button (type 1 only) always dismisses the dialog without calling any callback.
While a modal is open:
- All widget button and checkbox clicks are suppressed.
- The keyboard callback registered with
GEventAttachKeyis not invoked. - The mouse-click callback registered with
GEventAttachClickis not invoked.
Info Dialog
Confirm Dialog
Querying Modal State
1 if a modal is currently visible, 0 otherwise. Use this to pause game logic, animations, or any per-frame work that should not run while the user is reading a dialog.
Combining Modals with Window Close
A common pattern is to spawn a confirmation modal when the user tries to close the window, and perform the actual close inside theon_confirm callback:
Debug Overlay
When you run your application loop withGSimpleWindowLoop, the debug overlay is enabled automatically. Press F12 at runtime to toggle its visibility. The overlay is drawn in the top-left corner as a black box with a white border and two lines of white text:
| Line | Format | Meaning |
|---|---|---|
| 1 | FT: N (us) | Average frame time in microseconds, averaged over the last 60 frames |
| 2 | FPS: N.N | Current frames per second |
FT) measures the time spent doing real work each frame (event handling, rendering, and your on_every callback), not the total wall-clock time between frames. It is useful for spotting expensive draw calls or callback logic.
The debug overlay is only available when using
GSimpleWindowLoop. If you drive the loop manually with GHandleWindowEvents and GRenderWindow, the overlay infrastructure is never initialized and nothing is displayed.