GUI panels in a window (not in OpenFrames): Dear ImGui panels, buttons, checkboxes and sliders, drawn flat on top of the scene, through vsgImGui.
A window's Gui (WindowProxy%gui(), made on first use) is described
immediate-mode, each frame (e.g. in the event handler's before_draw, or
in the frame loop before frame()): panels (begin_panel ... end_panel)
holding text, buttons, checkboxes, sliders, combo boxes (drop-down
menus), separators. A widget's call gives what the user did with it at the
frame before: button is true once after a click; checkbox, slider
and combo change the value given (and are true then). What isn't described in a frame isn't shown in it.
A panel is placed where ImGui puts it (and can be moved), or at a position
(0 to 1 across the window, y up, as HUD text), at first or every frame
(follow): e.g. next to a picked object, kept at its screen position
(screen_position). A title starting with '##' gives no title
bar (a callout). Clicks, drags and keys over a panel go to it: the camera,
the event handler and picking don't get them. The GUI is scaled by the
window's pixel ratio. A Gui is a handle (copies are the same GUI), valid
while its window is open.
A window's GUI panels (see the module documentation).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(c_ptr), | public | :: | handle | = | c_null_ptr |
the window's GUI in the C++ layer (null: none) |
| procedure, public :: begin_panel | |
| procedure, public :: button | |
| procedure, public :: checkbox | |
| procedure, public :: combo | |
| procedure, public :: end_panel | |
| procedure, public :: is_valid | |
| procedure, public :: same_line | |
| procedure, public :: separator | |
| procedure, public :: slider | |
| procedure, public :: text |
A button: true once after it was clicked.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Gui), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | label |
the button's text |
A checkbox showing value: true (and value changed) after the user
changed it.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Gui), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | label |
the text next to it |
||
| logical, | intent(inout) | :: | value |
checked or not (changed by the user) |
A combo box (a drop-down menu) of items (trailing blanks trimmed),
showing item index (1-based): true (and index changed) after the
user chose another.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Gui), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | label |
the text next to it |
||
| integer, | intent(inout) | :: | index |
the item shown (1-based; changed by the user) |
||
| character(len=*), | intent(in) | :: | items(:) |
the menu's items (trailing blanks trimmed) |
False if the window has no GUI (not open).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Gui), | intent(in) | :: | self |
A slider showing value, from low to high: true (and value
changed) after the user moved it. format: how the value is shown
(printf's, e.g. '%.0f km'; default '%.4g').
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Gui), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | label |
the text next to it |
||
| real(kind=wp), | intent(inout) | :: | value |
shown, and changed by the user |
||
| real(kind=wp), | intent(in) | :: | low |
the slider's range |
||
| real(kind=wp), | intent(in) | :: | high |
the slider's range |
||
| character(len=*), | intent(in), | optional | :: | format |
printf's (default '%.4g') |
A panel titled title, with the widgets up to end_panel. A title
starting with ## (e.g. '##callout') gives a panel with no title bar,
e.g. a callout next to an object: what follows ## still names the
panel (Dear ImGui tells panels apart and keeps their state by it), but
isn't shown. position ([x, y], 0 to 1 across the window, y up; default:
where ImGui puts it) is where its point pivot is ([0, 0], the default:
its top left; [0.5, 1]: the middle of its bottom); with follow, every
frame (and it can't be moved), else at first.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Gui), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | title |
the title ('##' then a name: no title bar) |
||
| real(kind=wp), | intent(in), | optional | :: | position(2) |
[x, y] (0 to 1 across the window, y up) |
|
| real(kind=wp), | intent(in), | optional | :: | pivot(2) |
the panel's point at |
|
| logical, | intent(in), | optional | :: | follow |
place it every frame (default false: at first) |
End the panel started by begin_panel.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Gui), | intent(inout) | :: | self |
The next widget on the same line as the last.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Gui), | intent(inout) | :: | self |