A Minecraft style clone in Godot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

44 lines
1.3 KiB

extends Node
signal graphics_settings_changed(resolution: Vector2, fullscreen: bool, vsync: bool)
const BLOCK_PREFAB: PackedScene = preload("res://scenes/blocks/block.tscn")
const DROPPED_BLOCK_PREFAB: PackedScene = preload("res://scenes/blocks/dropped_block.tscn")
var enable_waila: bool = true ## Enable `What Am I Looking At` UI
var enable_block_highlight: bool = true
var graphics_settings: Dictionary[String, Variant] = {
"resolution": Vector2i.ZERO,
"fullscreen": false,
"vsync": false,
}
func _init() -> void:
graphics_settings_changed.connect(_on_graphics_settings_changed)
func apply_graphics_settings() -> void:
if graphics_settings.fullscreen:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
get_window().size = graphics_settings.resolution
if graphics_settings.vsync:
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED)
else:
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED)
func _on_graphics_settings_changed(resolution: Vector2i, fullscreen: bool, vsync: bool) -> void:
graphics_settings.resolution = resolution
graphics_settings.fullscreen = fullscreen
graphics_settings.vsync = vsync
apply_graphics_settings()