new_hud_text Function

private function new_hud_text(text, position, alignment, size, color, font) result(h)

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).

Arguments

Type IntentOptional 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

Return Value type(HUDText)


Calls

proc~~new_hud_text~~CallsGraph proc~new_hud_text new_hud_text proc~set_color HUDText%set_color proc~new_hud_text->proc~set_color

Called by

proc~~new_hud_text~~CalledByGraph proc~new_hud_text new_hud_text interface~hudtext HUDText interface~hudtext->proc~new_hud_text

Source Code

    function new_hud_text(text, position, alignment, size, color, font) result(h)
        character(len=*), intent(in) :: text            !! the text
        real(wp), intent(in), optional :: position(2)   !! [x, y] (0 to 1 across the window, y up)
        real(wp), intent(in), optional :: size          !! character height (window units)
        real(wp), intent(in), optional :: color(:)      !! [r, g, b] or [r, g, b, a] (0 to 1)
        integer, intent(in), optional :: alignment      !! an ALIGN_* constant
        character(len=*), intent(in), optional :: font  !! font file
        type(HUDText) :: h
        h%text_ = text
        if (present(position)) h%position_ = position
        if (present(alignment)) h%alignment_ = alignment
        if (present(size)) h%size_ = size
        if (present(color)) call h%set_color(color)
        if (present(font)) h%font_ = font
    end function new_hud_text