Skip to content

Range.imgui

Anastacio Engine module Range.imgui. Also available as bge.imgui.

These items exist in the engine but were not in the Range documentation. The ones marked new in Anastacio were added by Anastacio Engine.

function

Opens a window titled name. Everything you draw until end() goes inside it. With closable=True the window gets the X button, and want_close becomes True when it is clicked. Always call end() afterwards, even if is_open is False.

Returns: (is_open, want_close)

function

Draws the modal popup opened before with open_popup(name). Only call end_popup() when is_open is True.

Returns: (is_open, want_close)

function

Button with the text label. Returns True on the frame it is clicked. Width and height 0 fit the text.

Returns: bool

function

Checkbox. Pass the current value in value and keep new_value; changed is True when the player clicked.

Returns: (changed, new_value)

function

Closes the open popup.

function

RGB color picker (values from 0 to 1). Returns the new color.

Returns: (changed, r, g, b)

function

RGBA color picker with transparency (values from 0 to 1).

Returns: (changed, r, g, b, a)

function

Dropdown list. items is a list of strings and current_item the chosen index.

Returns: (changed, new_item)

draw_rect_filled(x1, y1, x2, y2, r, g, b, a)

Section titled “draw_rect_filled(x1, y1, x2, y2, r, g, b, a)”

function

– drawn above every window, for fades

function

Closes the window started with begin().

function

Closes a popup block.

function

Where the next item will be drawn, relative to the current window.

Returns: (x, y)

function

Where the next item will be drawn, in screen pixels.

Returns: (x, y)

function

Size of the drawing area in pixels. Useful to place windows and HUD.

Returns: (width, height)

function

True when the interface is using the keyboard (e.g. typing in a field). Use it to not move the character at that moment.

Returns: bool

function

True when the mouse is over the interface. Use it to ignore game clicks at that moment.

Returns: bool

function

– texture_id is a raw OpenGL bind code

function

Editable text field. max_length limits the number of characters.

Returns: (changed, new_value)

function

Clickable area with no drawing. Good to place over an image. Returns True when clicked.

Returns: bool

listbox(label, current_item, items, height_items=-1)

Section titled “listbox(label, current_item, items, height_items=-1)”

function

Scrolling list. height_items is how many lines show (-1 = automatic).

Returns: (changed, new_item)

new in Anastacio function

Returns: font_id or None -- engine font with icons; None until built next frame

function

Loads a .ttf/.otf font at the given size. Call it only once; the font is ready on the next frame. Use the id in push_font().

Returns: font_id

function

Opens the popup with that name.

function

Goes back to the font before push_font().

new in Anastacio function

Goes back to the width before push_item_width().

function

Undoes the last count colors from push_style_color().

new in Anastacio function

Undoes the last count styles from push_style_var().

function

Uses another font until pop_font().

new in Anastacio function

– >0 pixels, <0 right-aligned to the window edge (-1 = full width)

function

– idx is one of the imgui.COL_* constants

new in Anastacio function

or push_style_var(idx, x, y) – idx is one of imgui.STYLE_*

function

Option button. active says whether it is the chosen one; when pressed is True, store this option as the group choice.

Returns: pressed

function

Puts the next item on the same line as the previous one.

function

Draws a separator line.

function

– position relative to the current window

function

– enable/disable input + free mouse for Python-drawn game UI

new in Anastacio function

– same convention as push_item_width, next widget only

set_next_window_pos(x, y, cond=COND_ALWAYS)

Section titled “set_next_window_pos(x, y, cond=COND_ALWAYS)”

function

Position of the next window, in pixels.

set_next_window_size(w, h, cond=COND_ALWAYS)

Section titled “set_next_window_size(w, h, cond=COND_ALWAYS)”

function

Size of the next window, in pixels.

function

Slider for a float between min and max.

Returns: (changed, new_value)

function

Slider for an integer between min and max.

Returns: (changed, new_value)

function

Shows a text.