Skip to content

Reference Manual

This document serves as the combined reference guide for the uGUI (μGUI) framework, tailored for gint/sdk integration on ClassPad. It collates knowledge on the rendering engine, interactive widgets, OS-level keyboards, and built-in interactive dialogs.


uGUI requires an essential setup phase where drawing hooks and hardware context are initialized.

You must maintain a global UG_GUI structure that represents the core state of uGUI’s internal buffers.

void UG_Init(UG_GUI* g, void (*p)(UG_S16, UG_S16, UG_COLOR), UG_S16 x, UG_S16 y);
  • Arguments: The GUI object, a wrapper proxy function drawing individual setPixel commands, screen width, and height.
  • Font: Use UG_FontSelect(&FONT_8X8) to bind text.

uGUI internally invalidates drawing coordinates. Once properties change, call UG_Update() to process object redraws to your video buffer. You still must invoke the native hardware LCD_Refresh() afterwards.


Windows represent an isolated container of widgets. Only one Window is actively “focused” and receiving touch updates at a time.

Initializes a window and prepares its memory buffer.

void UG_WindowCreate(UG_WINDOW* wnd, UG_OBJECT* obj_buff, UG_U8 max_obj, void (*cb)(UG_MESSAGE*));
  • Arguments: Address of your UG_WINDOW, an array of UG_OBJECT pre-allocated locally to reserve UI widgets, and a specific user callback parsing events!

Toggles focus and rendering for an entire window. A disabled window immediately frees all children from the event queue safely.


Widgets are bound inside Windows via their specific creation macros. Note that coordinates x1, y1, x2, y2 are always relative to their parent Window.

void UG_ButtonCreate(UG_WINDOW* wnd, UG_BUTTON* btn, UG_U8 id, UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2);
void UG_ButtonSetText(UG_WINDOW* wnd, UG_U8 id, const char* text);

Standard touch-friendly clickable zones. Dispatches OBJ_EVENT_PRESSED.

void UG_TextboxCreate(UG_WINDOW* wnd, UG_TEXTBOX* txb, UG_U8 id, UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2);

Displays multi-line strings supporting alignment parameters (UG_TextboxSetAlignment). Formatted natively within boundaries without emitting events.

void UG_InputFieldCreate(UG_WINDOW* wnd, UG_INPUT_FIELD* txb, UG_U8 id, UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, char* buffer, UG_S16 max_length);

Provides a bound string buffer intercepting touch logic. Intended to be triggered alongside the UG_OSKeyboard. Emits EVENT_INPUTFIELD_CLICKED.

A highly modifiable sliding track, useful for brightness/volume UI. Emits SLD_EVENT_VALUE_CHANGED.

  • Modify range: UG_SliderSetRange(wnd, ID, min, max)
  • Handle queries: UG_SliderGetValue(wnd, ID)

uGUI provides baked-in, ready-to-use pop-ups standardizing user-input loops so you don’t have to assemble a Custom Window from scratch!

// Required initial call globally
UG_MessageBox_Init(&gui);
  1. Info Modal
    UG_MessageBox_ShowInfo("Information Details", "Popup Title");
  2. Confirm (Yes/No)
    UG_MessageBox_ShowConfirm("Do you want to continue?", "Confirmation");
  3. Text Prompt (Input string)
    char prompt_buffer[100];
    UG_MessageBox_ShowPrompt("Enter your name:", "Prompt", prompt_buffer, sizeof(prompt_buffer));

Dialogs act asynchronously within your event-loop polling. To see what the user did, actively check UG_MessageBox_GetResult() inside your while-loop:

UG_MESSAGEBOX_RESULT res = UG_MessageBox_GetResult();
if (res == UG_MESSAGEBOX_RESULT_YES) {
printf("User accepted confirmation!");
} else if (res == UG_MESSAGEBOX_RESULT_OK) {
printf("User typed: %s", prompt_buffer);
}

Because this is ported to a physical device/emulator, touch and hardware button clicks must be correctly routed to the uGUI engine for interactions to manifest.

Pass hardware touch coordinates via GetInput(&event);:

UG_TouchUpdate(event.data.touch_single.p1_x, event.data.touch_single.p1_y, TOUCH_STATE_PRESSED);

If dealing with an Input Field, UG_OSKeyboard heavily processes touch clicks directly (hijacking normal uGUI touch streams):

if (UG_OSKeyboard_ProcessTouch(x, y, 1)) {
// True? Means it was handled by the keyboard.
}

Provide hardware-button accessibility to your interface.

// KEYCODE_RIGHT or KEYCODE_DOWN
UG_Window_FocusNext(&window_1, 1); // Focus the next object ID sequentially
// KEYCODE_LEFT or KEYCODE_UP
UG_Window_FocusNext(&window_1, -1); // Focus previous