Custom level creation/ui.txt

From Turing Complete
Revision as of 00:45, 15 January 2025 by Altrag (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
wip
wip

This page descibes the early access verion 0.1346 Beta. It may not be completely correct for the the current stable version, nor the latest unstable version. Help us update it, and you get a cookie.

The ui.txt is used to define text and image metadata used by the bottom flyout panel, and can be manipulated from within the test.si test code. It has a relatively simple structure in comparison to the other files used for custom level creation. Each entry is a single line enclosed in square brackets ([]). There are currently only two valid entry types:

[text id="text_id" text="Any text you wish to display" font=mono size=24 align=left x=78 y=90 hidden=true]
[image id="image_id" file="filename.png" x=78 y=90 hidden=true]
ui.txt is not hot-reloaded, even upon level change. You will need to restart the game to pick up changes to this file.

Text metadata[edit | edit source]

[text id="text_id" text="Any text you wish to display" font=mono size=24 align=left x=78 y=90 hidden=true]
  • id An identifier that can be used by the test code to reference the text object.
  • text The text to be displayed.
  • font The font face. Currently only mono is supported. Any other option will use the game's normal font.
  • size The font size. The game's standard size is 24.
  • align The text alignment. Can be left or right. The default is centered text.
    • <translate> Note</translate> Note: The alignment is measured from center, so left aligned grows from center to the right, and <right> aligned grows from center to the left. This can make it appear like the values are reversed if you're not expecting it!
  • x The horizontal offset of the text from the center of the panel (negative values are left).
  • y The vertical offset of the text from the top of the panel (negative values are up - above the panel itself).
  • hidden If true, the text will not be displayed until the test code changes this property to false.

Image metadata[edit | edit source]

Images currently need to be compiled into the game files. Simply including them in your level directory is not sufficient and attempting to reference such a file will result in the game crashing on startup.
You can reuse images from existing levels using normal path navigation (eg: ../sort/0.png for a slice of pie on a plate). This should not be considered a viable long-term solution as your level becomes dependent both on the other level(s) not changing their images, and also on the game not enforcing directory locality in the future. It can be a good placeholder during development however, and if your level is accepted into the base game you can replace the temporary image references with valid ones at that time.
[image id="image_id" file="filename.png" x=78 y=90 hidden=true]
  • id An identifier that can be used by the test code to reference the image object.
  • filename The name of the file to load.
  • x The horizontal offset of the image from the center of the panel (negative values are left).
  • y The vertical offset of the image from the top of the panel (negative values are up - above the panel itself).
  • hidden If true, the image will not be displayed until the test code changes this property to false.