Skip to content

UIElements

advexed edited this page Sep 22, 2026 · 9 revisions

Glossary

Intro

UI in this game is built from elements - each element containing its own defined behaviour. They're internally called UIElements, and this is the name they'll be referenced by from now on. UIElements can be created either by defining them in a menu's .txt file (found in /gd3ds/romfs/menus/) or by calling their appropriate ui_create function.

Accessing and modifying existing UI elements

UIElements can be referenced by optional tags - think of them like HTML classes if you've worked with web development.

You can directly access a UIElement in code by defining a static UIElement *variable and setting it to the pointer of your target with the ui_get_element_by_tag function. They can also be modified in bulk by calling ui_run_func_on_tag, which allows you to run any function with the structure of func(UIElement *element) (plus a few default functions), on all elements with the provided tag. One element may have multiple tags, separated by a comma.

Related functions:

ui_get_element_by_tag(UIScreen *screen, char *tag) - returns a pointer to the first found UIElement with matching tag. if none are found, returns NULL. ui_run_func_on_tag(UIScreen *screen, char *tag, void function) - runs a function of your choice on every element with provided tag. ui_disable_element(UIElement *element) - disables provided element. ui_enable_element(UIElement *element) - re-enables provided element.

Dictionary of UI elements

UIElement (base)

Description

This is the base template upon which all other elements are built. The UIElement struct contains all of the core initialisation, updating, drawing and destructing logic + properties that other elements share and build upon.

.txt declaration:

[NOT APPLICABLE]


UIRectangle

Basic rectangle. Often used as a background for list element entries.

.txt declaration:

rectangle x=? y=? w=? h=? tag="???" tint=??????

Related functions:

ui_create_rectangle(*screen) - creates a UIRectangle struct and returns its pointer. ui_rectangle_set_color(*UIRectangle, u32 color) - tints rectangle to provided C2D_Color32.


UIBackgroundGradient

Description

Background gradient. Stretches across the entire screen, is used as the background in most fullscreen menus. If servers are set to the 1.9 GDPS, the texture changes to the one from their client.

.txt declaration

bggradient tint=??????? tag="???"

Related functions:

ui_create_bg_gradient(UIScreen *screen) - creates and returns a UIBackgroundGradient struct. ui_gradient_set_tint(UIBackgroundGradient *bggradient, u32 color) - sets background gradient's tint to provided C2D_Color32.


UIDarken

Description

The shadow layer behind most popups - black rectangle with a customisable opacity and fade duration. If desired, position and dimensions can be customised.

.txt declaration

darken x=? y=? w=? h=? opacity=? darkenTime=?

Related functions:

ui_create_darken(UIScreen *screen) - creates a UIDarken struct and returns its pointer. ui_darken_set_opacity(UIDarken *darken, float opacity) - instantly sets a darken's opacity to provided value. ui_darken_reset_opacity(UIDarken *darken) - resets darken's opacity to 1.


UIImage

Description

Basic image element. Displays the image at an index of your choosing, with adjustable scale and tint. The displayed image can be changed at any time by modifying its sprite index and/or spritesheet index. Base dimensions are identical to that of the image at the provided index.

.txt declaration

image x=? y=? id=? sheet=? scale=? sx=? sy=? tint=?

Related functions

ui_create_image(UIScreen *screen) - creates a UIImage struct and returns a pointer to it. ui_image_set_tint(UIImage *image, u32 color) - sets the provided UIImage's tint to provided C2D_Color32. ui_image_clear_tint(UIImage *image) - resets the image's tint. ui_image_set_image(UIImage *image, int sprite_index, int sheet) - sets the element's image to the one corresponding to provided index and spritesheet.


UIWindow

Description

Draws a window (9 slice) of target style at target position with target dimensions. Can be tinted to any colour and opacity. The style can also be changed at any time by modifying the window's atlas.

.txt declaration

windows x=? y=? w=? h=? style=? tint=??????

Related functions

ui_create_window(UIScreen *screen) - Creates a UIWindow struct and returns its pointer. ui_window_set_tint(UIWindow *window, u32 color) - Sets window's tint to provided C2D_Color32. ui_window_set_atlas(UIWindow *window, int index) - Sets atlas (style) of the target window. For a table of currently existing ones, click here.


UIButton

Description

Interactive UIImage which can be assigned keybinds, a set of actions, display text of your choosing at a scale of your choosing, and can carry custom data. Buttons can choose from a set of two hover animations: scaling up and sliding downwards. They can also be assigned custom userdata - which is available in their properties once loaded.

.txt declaration

button x=? y=? id=? sheet=? scale=? sx=? sy=? keyBinds=?,? actions=“???”,”???” text=“???” textScale=? custom=[variablename=???]

Related functions

ui_button_set_image(UIButton *button, int sprite_index, int sheet) - sets the image of target button to the one under the provided index and spritesheet ui_button_set_text(UIButton *button, char *text) - sets the text of a button to provided string.


UIWindowButton

Description

Interactive UIWindow which can be assigned keybinds, a set of actions, display text of your choosing at a scale of your choosing, and can carry custom data. Buttons can be assigned custom userdata - which is available in their properties once loaded.

.txt declaration

windowbutton x=? y=? style=? w=? h=? keyBinds=?,? actions=“???”,”???” text=“???” textScale=? custom=[variablename=???]

Related functions

ui_button_set_image(UIButton *button, int sprite_index, int sheet) - sets the image of target button to the one under the provided index and spritesheet. ui_button_set_text(UIButton *button, char *text) - sets the text of a button to provided string.


UICheckbox

Description

UIButton which can be checked/unchecked. Executes a chosen action upon use.

.txt declaration

checkbox x=? y=? tag=“???” scale=? sx=? sy=? actions=“???”

Related functions

ui_checkbox_set_checked(UICheckbox *checkbox, bool checked) - sets the state of the checkbox. ui_checkbox_create(UIContext *ctx) - creates a UICheckbox struct and returns its pointer.


UIColor

Description

UIButton which displays the color at index of your choice. Used exclusively in the icon kit.

.txt declaration

colorbutton x=? y=? scale=? sx=? sy=? actions=“???”,”???”

Related functions:

ui_color_button_set_index(UIColor *e, int index, int color_index) - sets color button to target color index. ui_create_color_button(UIContext *ctx) - creates UIColor struct and returns its pointer.


UILabel

Description

General purpose text element. Displays text of your choice with font and alignment of your choice. If a width is defined, the displayed text will automatically be scaled to fit within it.

.txt declaration

label x=? y=? w=? scale=? sx=? sy=? tag=“???” text=“???” font=?

Related functions

ui_label_set_text(UILabel *label, char *text) - sets label’s text to that of the provided char. ui_create_label(UIContext *ctx) - creates UILabel struct and returns its pointer.


UITextbox

Description

Text input field. Brings up the 3DS’ system keyboard upon activation, input length limit and placeholder message can be customised. Typed text also scales to fit the element’s width.

.txt declaration

textbox x=? y=? w=? limit=? title=“???” tag=“???” actions="???”

Related functions

ui_create_textbox(UIContext *ctx) - creates UITextbox struct and returns its pointer.


UIList

Description

Vertically scrollable list element. All subelements of a list are treated as its entries, each one being positioned immediately after the previous. The list’s background color can also be set to any value of your choice.

Related functions

ui_create_list(UIContext *ctx) - creates UIList struct and returns its pointer ui_reset_list(UIList *list) - destroys all current list entries. ui_list_add(UIList* list, UIElement* entry) - adds target UIElement to UIList.


UIIcon

Description

Player icon element. Used in the icon kit as well as in official server comments. Can display any 1.0-2.2 player icon with or without glow, in every color, in every gamemode. Can also display a selection 
IDs of the target icons match that of actual gd, colors don’t. To convert a Geometry Dash color index to a GD3DS one, use the gd_to_gd3ds_color_table LUT located within the palette_kit.c menu file.

.txt declaration

icon x=? y=? scale=? gamemode=? id=? hoverFactor=? p1_color=?????? p2_color=?????? glow_color=?????? glow=true/false

related functions:

ui_icon_set_selected(UIIcon *icon, bool selected) - sets the icons ‘selected’ status. ui_icon_set_gamemode_index(UIIcon *icon, int gamemode, int index) - sets the gamemode and icon index of an UIIcon ui_icon_set_p1(UIIcon *icon, u32 color) - sets the color of the UIIcon’s p1 layer. ui_icon_set_p2(UIIcon *icon, u32 color) - sets the color of the UIIcon’s p2 layer. ui_icon_set_glow(UIIcon *icon, u32 color) - sets the color of the UIIcon’s glow layer.

UIProgressBar

Description

Progress bar. Has several border styles to choose from as well as a customisable main bar color.

.txt declaration

progressbar x=? y=? scale=? max_value=? style=? tag="???"

Related functions

ui_create_progress_bar(UIScreen *screen) - creates UIProgressBar struct and returns its pointer.


UISlider

Description

UIProgressBar with added slider functionality.

.txt declaration

slider x=? y=? scale=? max_value=? style=? tag="???"

Related functions

ui_create_slider(UIScreen *screen) - creates UISlider struct and returns its pointer. ui_slider_get_percent(UISlider *e) - [float] returns current value of slider. ui_slider_set_value(UISlider *e, float value) - sets slider to target value.


UISpinner

Description

Spinning UIImage with optional blending and customizable rotation speed (measured in pixels/second).

.txt definition

spinner x=? y=? id=? sheet=? scale=? sx=? sy=? tint=? blending=true/false speed=?

Related functions

ui_create_spinner(UIScreen *screen) - creates UISpinner struct and returns its pointer.


UIParticle

Description

Element which acts as a layer on which you can spawn particles. Doesn’t do anything by itself, has to be accessed later in code.

.txt declaration

particle tag=“???”


UIUseEffect

Element which acts as a layer on which you can spawn circle effects. Doesn’t do anything by itself, has to be accessed later in code.

.txt declaration

useeffect tag=“???”

List of UIElement properties

  • x - [float] element's horizontal position. counted from the left, in pixels.
  • y - [float] element's vertical position. counted from the top, in pixels.
  • w - [float] element's width, in pixels.
  • h - [float] element's width, in pixels.
  • scale - [float] element's combined x and y scale.
  • sx - [float] element's horizontal scale.
  • sy - [float] element's vertical scale.
  • userdata - custom data is stored here. the specifics of custom properties are explained here.
  • tag - [char] tag by which an element can be accessed from later in code. separate multiple tags using commas.
  • tint - [char] color to which the element should be tinted. can be provided in the following formats: #RRGGBB, #RRGGBBAA, rr,gg,bb and rr,gg,bb,aa.
  • opacity - [float] element' target opacity.
  • darkenTime - [float] how long it takes a UIDarken to reach its target opacity, measured in seconds.
  • id: [int] index of target image in its corresponding spritesheet. you can check an image's index by copying its name from the gfx folder and checking what (line number - 2) said name is located at in the appropriate spritesheet's .t3s file.
  • sheet: [int] index of your desired spritesheet.
  • style - [int] index of a window's style.
  • keyBinds - one or multiple physical keys to trigger this button, separated by commas.
  • actions - one or multiple actions that should be executed upon activation. quotes are optional, separate multiple actions with commas.
  • custom - one or multiple custom variables which can be accessed inside the element’s properties. variables are always strings, if a different variable type is desired, you’ll have to convert them manually.
  • text - [char] text to be displayed by an element.
  • textScale - [float] scale of buttons text, if left unset / equal to 0, text will be shrunk to fit automatically.
  • gamemode - [int] index of the target player icon's gamemode. same as in actual Geometry Dash.
  • id (icon) - [int] index of the target player icon. same as in actual Geometry Dash.
  • p1_color - [int] id of the target icon's player 1 color. to convert a Geometry Dash color index to a GD3DS one, use the gd_to_gd3ds_color_table[] LUT from /menus/icon_kit.h
  • p2_color - [int] id of the target icon's player 2 color. to convert a Geometry Dash color index to a GD3DS one, use the gd_to_gd3ds_color_table[] LUT from /menus/icon_kit.h
  • glow_color - [int] id of the target icon's glow color. to convert a Geometry Dash color index to a GD3DS one, use the gd_to_gd3ds_color_table[] LUT from /menus/icon_kit.h
  • glow - [bool] if target icon should have glow.
  • hoverFactor - [float] what scale the element should approach if hovered
  • max_value - [float] value which a progress bar should approach.
  • color - element's target color.
  • blending - [bool] if element should have blending.

Default UIElement property values

(TO BE ADDED)