03.styling-the-scoreboard-with-a-theme

Styling the scoreboard with a theme

In this video, we use Godot’s Theme resource to give our interface a default font and a nicer panel style.

New concepts

Resources

In Godot, resources are typically files that you plug into nodes. Textures, sounds, and fonts are all examples of resources.

We looked at several of them in this video: the Theme resource, the DynamicFont, and the StyleBoxFlat we assigned to the scoreboard’s panel.

More precisely, a resource is a data container that Godot loads and reuses efficiently.

Most of your game’s shared data will rely on resources, like the fonts that you reuse throughout your user interface.

Each of the blocks outlined below corresponds to a different kind of resource.

Font files

Your computer uses font files to draw text.

These files contain drawings of each text character in a particular image format called vector. It allows the computer to draw text of any size without the text becoming blurry or pixelated.

Common font file extensions are .ttf (TrueType Font: a proprietary format by Apple) and .otf (OpenType Font: an open format).

Dynamic font resources in Godot

To change a text’s font and drawing size, Godot requires you to create a DynamicFont resource. This resource uses a font file to draw the text and a couple of settings to change the text size, the line size, etc.