mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
04691aaa48
Lands the non-networked Phase 0 tasks from multiplayer-todo.md (ship/camera/ arena refactors, sim constants, background FPS handling) plus a first pass at exposing graphics/performance settings (presets, resolution scaling, vsync, FPS cap, perf overlay) and a GPU profiling harness for the real-hardware follow-up in task 0.15b.
23 lines
806 B
GDScript
23 lines
806 B
GDScript
extends Node
|
|
|
|
# Autoload: drops Engine.max_fps while the window is unfocused, so an idle
|
|
# background window doesn't keep rendering at whatever uncapped rate the
|
|
# hardware can hit. Independent of — and complementary to — the per-menu
|
|
# refresh-rate cap in main_menu.gd/settings_menu.gd, which only covers menu
|
|
# screens; this covers every scene, including gameplay.
|
|
|
|
const BACKGROUND_FPS := 30
|
|
|
|
# 0 means "uncapped"; also what we restore to if focus is lost before any
|
|
# menu/gameplay scene has had a chance to set its own cap.
|
|
var _foreground_max_fps := 0
|
|
|
|
|
|
func _notification(what: int) -> void:
|
|
match what:
|
|
NOTIFICATION_APPLICATION_FOCUS_OUT:
|
|
_foreground_max_fps = Engine.max_fps
|
|
Engine.max_fps = BACKGROUND_FPS
|
|
NOTIFICATION_APPLICATION_FOCUS_IN:
|
|
Engine.max_fps = _foreground_max_fps
|