HUD text: text drawn on top of the scene at a fixed place in a window, as OpenFrames' HUD text (one per RenderRectangle there; any number here).
Its position is (x, y) from 0 to 1 across the window, left to right and bottom to top, and the text's alignment (an ALIGN_* constant) says which point of the text is there; its size is in window units (logical pixels). Everything can change at any time, also while shown: the text (e.g. a clock; up to 256 characters, or twice the text's length when first shown if more: longer ones are cut), color, position, size and alignment in place, and the font (the text is made again). Moved each frame to an object's place on the screen (screen_position), it is a callout that follows the object. A HUDText can be shown in several windows (add_hud_text); it is not owned by them and must stay alive while shown.
The HUDText constructor: HUDText(...) makes one (see new_hud_text for its
arguments).
HUD text text, optionally at position ([x, y], 0 to 1; default near
the bottom left), with alignment (default ALIGN_LEFT_BOTTOM), size
(window units; default 20), color ([r, g, b] or [r, g, b, a]; default
white) and font (default: the default font).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | text |
the text |
||
| real(kind=wp), | intent(in), | optional | :: | position(2) |
[x, y] (0 to 1 across the window, y up) |
|
| integer, | intent(in), | optional | :: | alignment |
an ALIGN_* constant |
|
| real(kind=wp), | intent(in), | optional | :: | size |
character height (window units) |
|
| real(kind=wp), | intent(in), | optional | :: | color(:) |
[r, g, b] or [r, g, b, a] (0 to 1) |
|
| character(len=*), | intent(in), | optional | :: | font |
font file |
HUD text (see the module documentation).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | alignment_ | = | ALIGN_LEFT_BOTTOM |
the point of the text at |
|
| real(kind=wp), | private | :: | color_(4) | = | [1.0_wp, 1.0_wp, 1.0_wp, 1.0_wp] |
[r, g, b, a] (0 to 1) |
|
| character(len=:), | private, | allocatable | :: | font_ |
font file (unallocated: the default font) |
||
| real(kind=wp), | private | :: | position_(2) | = | [0.01_wp, 0.01_wp] |
[x, y] (0 to 1 across the window, y up) |
|
| integer, | private | :: | revision_ | = | 0 |
incremented by each change |
|
| logical, | private | :: | shown | = | .true. |
false while hidden |
|
| real(kind=wp), | private | :: | size_ | = | 20.0_wp |
character height (window units) |
|
| character(len=:), | private, | allocatable | :: | text_ |
the text |
The HUDText constructor: HUDText(...) makes one (see new_hud_text for its
arguments).
| private function new_hud_text (text, position, alignment, size, color, font) | HUD text |
| procedure, public :: alignment | |
| procedure, public :: color | |
| procedure, public :: font | |
| procedure, public :: is_shown | |
| procedure, public :: position | |
| procedure, public :: revision | |
| procedure, public :: set_alignment | |
| procedure, public :: set_color | |
| procedure, public :: set_font | |
| procedure, public :: set_position | |
| procedure, public :: set_size | |
| procedure, public :: set_text | |
| procedure, public :: show | |
| procedure, public :: size | |
| procedure, public :: text |
Which point of the text is at its position (an ALIGN_* constant).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(HUDText), | intent(in) | :: | self |
The color: [r, g, b, a] (0 to 1).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(HUDText), | intent(in) | :: | self |
The font file ('' for the default font).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(HUDText), | intent(in) | :: | self |
True if the text is shown.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(HUDText), | intent(in) | :: | self |
HUD text text, optionally at position ([x, y], 0 to 1; default near
the bottom left), with alignment (default ALIGN_LEFT_BOTTOM), size
(window units; default 20), color ([r, g, b] or [r, g, b, a]; default
white) and font (default: the default font).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | text |
the text |
||
| real(kind=wp), | intent(in), | optional | :: | position(2) |
[x, y] (0 to 1 across the window, y up) |
|
| integer, | intent(in), | optional | :: | alignment |
an ALIGN_* constant |
|
| real(kind=wp), | intent(in), | optional | :: | size |
character height (window units) |
|
| real(kind=wp), | intent(in), | optional | :: | color(:) |
[r, g, b] or [r, g, b, a] (0 to 1) |
|
| character(len=*), | intent(in), | optional | :: | font |
font file |
Where the text is: [x, y] (0 to 1 across the window, y up).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(HUDText), | intent(in) | :: | self |
Number of changes so far (for the windows drawing the text to update it).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(HUDText), | intent(in) | :: | self |
Set which point of the text is at its position.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(HUDText), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | alignment |
an ALIGN_* constant |
[r, g, b] (alpha unchanged) or [r, g, b, a], 0 to 1.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(HUDText), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | color(:) |
[r, g, b] or [r, g, b, a] (0 to 1) |
Set the font (the text is made again when next drawn).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(HUDText), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | font |
font file |
Set where the text is.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(HUDText), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | position(2) |
[x, y] (0 to 1 across the window, y up) |
Set the size of the text.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(HUDText), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | size |
character height (window units) |