36 lines
770 B
GDScript
36 lines
770 B
GDScript
extends Node
|
|
|
|
var master_volume: float = 1.0
|
|
var fullscreen: bool = false
|
|
var vsync : bool = false
|
|
var max_fps: int = 60
|
|
|
|
func apply_volume():
|
|
var bus_index := AudioServer.get_bus_index("Master")
|
|
AudioServer.set_bus_volume_db(
|
|
bus_index,
|
|
linear_to_db(master_volume)
|
|
)
|
|
|
|
func apply_fullscreen():
|
|
DisplayServer.window_set_mode(
|
|
DisplayServer.WINDOW_MODE_FULLSCREEN if fullscreen
|
|
else DisplayServer.WINDOW_MODE_WINDOWED
|
|
)
|
|
if not fullscreen:
|
|
get_window().size = Vector2i(480*3, 270*3);
|
|
|
|
func apply_vsync():
|
|
DisplayServer.window_set_vsync_mode(
|
|
DisplayServer.VSYNC_ENABLED if vsync
|
|
else DisplayServer.VSYNC_DISABLED
|
|
)
|
|
|
|
func apply_max_fps():
|
|
Engine.max_fps = max_fps
|
|
|
|
func apply_all():
|
|
apply_volume()
|
|
apply_fullscreen()
|
|
apply_vsync()
|
|
apply_max_fps()
|