Module: gameui.widgets
Source: ./gameui/widgets.reef
Overview
gameui/widgets.reef - Immediate mode UI widgets Part of reef-stdlib Game UI module
This module provides immediate mode widgets for game UIs. Each widget function draws the widget and returns its interaction result.
Usage: if ui_button(ctx, "Play") { start_game() } if ui_checkbox(ctx, "Sound", sound_enabled) { sound_enabled = !sound_enabled } ui_slider(ctx, "Volume", &volume, 0.0, 1.0)
Functions
fn ui_button(c: ctx.UIContext, label: string): bool
fn ui_button_sized(c: ctx.UIContext, label: string, width: float, height: float): bool
fn ui_checkbox(c: ctx.UIContext, label: string, checked: bool): bool
fn ui_radio(c: ctx.UIContext, label: string, selected: bool): bool
fn ui_slider(c: ctx.UIContext, label: string, value: float, min: float, max: float): float
fn ui_slider_int(c: ctx.UIContext, label: string, value: int, min: int, max: int): int
fn measure_text_width(text: string, font_size: float): float
fn text_length(s: string): int
fn char_at_str(s: string, idx: int): int
fn int_to_float(i: int): float
fn float_to_int(f: float): int
Procedures
proc ui_label(c: ctx.UIContext, text: string)
proc ui_label_colored(c: ctx.UIContext, text: string, color: core.Color)
proc ui_progress(c: ctx.UIContext, value: float, width: float)
proc ui_progress_colored(c: ctx.UIContext, value: float, width: float, color: core.Color)
proc ui_text(c: ctx.UIContext, text: string)
proc ui_separator(c: ctx.UIContext, width: float)
proc ui_panel_begin(c: ctx.UIContext, width: float, height: float)
proc ui_panel_end(c: ctx.UIContext)
proc ui_tooltip(c: ctx.UIContext, text: string)
proc ui_header(c: ctx.UIContext, text: string)
proc ui_spacing(c: ctx.UIContext, amount: float)
proc ui_same_line(c: ctx.UIContext)
proc ui_new_line(c: ctx.UIContext)
proc ui_indent(c: ctx.UIContext, amount: float)
proc ui_unindent(c: ctx.UIContext, amount: float)
proc draw_text_placeholder(surf: surface.Surface, x: float, y: float, width: float, height: float, color: core.Color)
proc draw_rect_border(surf: surface.Surface, rect: core.Rect, color: core.Color, width: float)
proc advance_after_widget(c: ctx.UIContext, width: float, height: float)
proc update_line_height(c: ctx.UIContext, height: float)
Generated by reefc doc