A video display autoload singleton to handle all video configuration for a game. (Monitors, not cameras.)
For use with Godot 4.6.stable and later.
The following dependencies are included in the addons folder and are required for the template to function.
- Copy the
dragonforge_displayfolder from theaddonsfolder into your project'saddonsfolder. - If it does not exist already, copy the
dragonforge_diskfolder from theaddonsfolder into your project'saddonsfolder. - If it does not exist already, copy the
dragonforge_user_interfacefolder from theaddonsfolder into your project'saddonsfolder. - In your project go to Project -> Project Settings...
- Select the plugins tab.
- Check the On checkbox under Enabled for Dragonforge Disk (must be enabled before the Display plugin or you will get errors).
- Check the On checkbox under Enabled for Dragonforge Display.
- Check the On checkbox under Enabled for Dragonforge User Interface.
- Press the Close button.
Handles changing screen resolution, switching from windowed to full screen, scaling, and multiple monitors. Also allows the saving and loading of all these settings by default. In other words, calling these functions also sets the values and reloads them for the player on game start.
In res://addons/dragonforge_display/ui/screens/display.tscn there is a default screen for setting all available display options. Using res://test/test.tscn, you can test all these settings out. Pressing the Run Prjoject (F5) button will also allow you to test everything.
If you want to change what resolutions are available to the player, edit the RESOLUTIONS constant in display.gd. current value are:
const RESOLUTIONS: Array[Vector2i] = [
Vector2i(3840, 2160),
Vector2i(2560, 1080),
Vector2i(1920, 1080),
Vector2i(1536, 864),
Vector2i(1366, 768),
Vector2i(1280, 720),
Vector2i(1440, 900),
Vector2i(1600, 900),
Vector2i(1152, 648),
Vector2i(1024, 600),
Vector2i(800, 600),
Vector2i(630, 500), # Added for Itch.io cover image screenshots
]
fullscreen(fullscreen_on: bool)Sent when fullscreen is toggled on/off.video_scale_changed(new_value: float)Sent when the 3D video scale is changed. (Only possible in fullscreen.)window_moved_to_monitor(new_monitor_id: int)Sent when a new monitor is selected. (Note dragging the window to a new monitor only has an effect is the size of the window is also changed. Otherwise the value must be set throughselect_monitor(monitor_number: int)to send this signal.resolution_changed(new_resolution: Vector2i)Sent when the screen resolution changes. (But not if it changes because fullscreen was toggled.)
RESOLUTIONSAn array storing all the resolutions the player can choose from when hooked up to a UI.
full_screen(on: bool) -> voidTurn fullscreen on/off.is_fullscreen() -> boolReturns whether fullscreen is currently on.set_resolution(resolution: Vector2i) -> voidSet monitor resolution.select_monitor(monitor_number: int) -> voidMove the game to the passed monitor.scale_zoom(zoom: float) -> voidChange the 3D scale zoom. (Only has an effect in fullscreen mode.)get_scaling() -> floatGet 3D scaling value. (Only has an effect in fullscreen mode.)
This project's UI has been created to work with localization. You can easily use localization by using the Dragonforge Localization plugin. The following labels exist and should be given translations:
- DISPLAY_SETTINGS
- MONITOR
- FULLSCREEN
- RESOLUTION
- ZOOM_SCALE
- BACK