Skip to content

Screens

Quetzy edited this page Jun 19, 2022 · 4 revisions

A Screen file defines a top-level chunk of UI that you can add to your game. You might have a Main Menu screen, and Options screen, an Inventory screen, etc.

The Example Project has several screens that you can browse here:
https://github.com/shdwcat/YUI/tree/main/datafiles/YUI/Screens

Screen File Format

A screen file is defined in YAML, and has the following top-level properties:

file_type

Type: screen
The file_type helps YUI understand what kind of file it is looking at, and can help catch certain errors where you might refer to the wrong kind of file accidentally. A Screen file must always have file_type: screen.

import

Type: Array of file path strings
The import property allows you to import other resources and interactions for use by the screen. File paths are relative to the location of the current file, so you may need to prefix the path with ../ etc. if you need to import a file in a different folder than that of the current file. See Importing Resources for more details.

resources

Type: resources map
The resources property lets you define resources directly in the screen file, without needing to import another file. This can be handy when doing quick iteration, or if you know a resource is only going to be used in this particular screen.

root

Type: YUI Element
The 'root' is where you put the actual YUI content to be rendered! This will almost always be a panel, but you might also use a Template or Fragment as you get more advanced.