mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 00:14:00 +00:00
chore(multiplayer): Phase 0 refactors + graphics/perf settings groundwork
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.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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
|
||||
Reference in New Issue
Block a user