A user interface autoload singleton to handle UI screens for a game.
For use with Godot 4.6-stable and later.
This plugin has no dependencies that are required for the code to work.
- Copy all the
dragonforge_user_interfacefolder from theaddonsfolder into your project'saddonsfolder. - Optionally copy the
dragonforge_diskanddragon_forge_soundfolders from theaddonsfolder into your project'saddonsfolder (if you want the button click sound to work). - In your project go to Project -> Project Settings...
- Select the Plugins tab.
- Check the On checkbox under Enabled for Dragonforge User Interface
- Optionally check the On checkbox under Enabled for Dragonforge Disk (must be enabled before the Sound plugin or you will get errors).
- Optionally check the On checkbox under Enabled for Dragonforge Sound.
- Press the Close button.
- Save your project.
This is intended to be used with the - Dragonforge Game Template
Pressing the Run Project (F5) button will run the test project. All the splash screens will display. You will then get two screens, each with a button that loads the other screen.
Three splash screens are included in the addons folder under splash_screens. Two animated Godot logo video versions, and the Dragonforge Dev splash screen using an AnimationPlayer. All the other examples can be found in res://ui/splash_screens/ under their respectively named folders. All splash screen assets are stored with their splash screen to make copying, adding, or removing screens easy to do from a project.
A default screen that is tracked by the UI autoload. All buttons in the screen are automatically hooked up to play the click sound set up in the Sound autoload. It also allows you to set a default control for when the screen loads, and tracks the last button pressed for when a player returns to this screen.
default_focused_control: ControlThe control that receives focus by default when starting.
A screen for display upon starting the game. Typically either plays a video or an animation. The sound can optionally be muted if you want to play one contiguous opening theme.
signal splash_completeIndicates that this splash screen is done playing. Tied directly to the display_time export variable.
mute_sound: bool = falseCheck this to turn off splash screen sound to allow the playing of theme music on startup.display_time: float = 1.0The amount of time the splash screen should be shown. Ignored if either [member video_player] or [member animation_player] have values, instead waiting for their finished signal.video_player: VideoStreamPlayerIf a VideoStreamPlayer is placed here, it will automatically be run. Ignored if left blank.animation_player: AnimationPlayerIf an AnimationPlayer is placed here, it will automatically play the "Show" animation. Ignored if left blank.
The UI autoload scene.
register_screen(screen: Screen) -> voidRegisters a new screen to the UI autoload ensuring only one screen at a time is open. (Used by the Screen object.)open_screen(screen: Screen) -> voidOpens a new Screen and closes the currently open screen.open_screen_by_name(screen_name: String) -> voidOpens a new Screen by the screen's name and closes the currently open screen.open_pop_up_by_name(screen_name: String) -> voidOpens a new Screen by the screen's name without closing the currently open screen.close_screen_by_name(screen_name: String) -> voidCloses a Screen by the screen's name.