Debug overlay (FPS + VSync) toggleable con F11
Crea core/system/DebugOverlay como sistema global propiedad del Director
que muestra FPS y estado de VSync en la esquina superior izquierda usando
VectorText. Visible por defecto en builds debug, oculto en release; F11
alterna.
Cambios:
- Nuevo DebugOverlay con su propio contador de FPS interno (cadencia 0.5s).
El cálculo que vivía en SDLManager::updateFPS se mueve aquí.
- Director construye el overlay una vez y lo pasa a runFrameLoop. F11 se
intercepta directamente en el event loop del Director (no en
GlobalEvents para no acoplar la firma a la presencia del overlay).
- Limpieza de SDLManager: fuera updateFPS, updateColors (era no-op desde
Fase 8c), setWindowTitle (no se usaba) y los campos fps_*.
- Título de ventana estático estilo CCAE:
© 2026 Orni Attack — JailDesigner
Ya no se reescribe cada 0.5s con FPS y VSync; ese estado vive en el
overlay.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,8 +21,10 @@ namespace {
|
||||
auto initWindowAndGpu(SDL_Window** out_window,
|
||||
Rendering::Renderer& gpu_renderer,
|
||||
int width, int height, bool fullscreen) -> bool {
|
||||
// Construir título dinámico
|
||||
const std::string TITLE = std::format("{} v{} ({})", Project::LONG_NAME, Project::VERSION, Project::COPYRIGHT);
|
||||
// Título estático estilo CCAE. El FPS y el estado de VSync los muestra
|
||||
// el DebugOverlay (toggle F11), no la barra de título.
|
||||
const std::string TITLE = std::format("© 2026 {} — JailDesigner",
|
||||
Project::LONG_NAME);
|
||||
|
||||
SDL_WindowFlags flags = SDL_WINDOW_RESIZABLE;
|
||||
if (fullscreen) {
|
||||
@@ -62,9 +64,6 @@ auto initWindowAndGpu(SDL_Window** out_window,
|
||||
|
||||
SDLManager::SDLManager()
|
||||
: finestra_(nullptr),
|
||||
fps_accumulator_(0.0F),
|
||||
fps_frame_count_(0),
|
||||
fps_display_(0),
|
||||
current_width_(Defaults::Window::WIDTH),
|
||||
current_height_(Defaults::Window::HEIGHT),
|
||||
is_fullscreen_(false),
|
||||
@@ -95,9 +94,6 @@ SDLManager::SDLManager()
|
||||
|
||||
SDLManager::SDLManager(int width, int height, bool fullscreen)
|
||||
: finestra_(nullptr),
|
||||
fps_accumulator_(0.0F),
|
||||
fps_frame_count_(0),
|
||||
fps_display_(0),
|
||||
current_width_(width),
|
||||
current_height_(height),
|
||||
is_fullscreen_(fullscreen),
|
||||
@@ -334,47 +330,8 @@ void SDLManager::present() {
|
||||
gpu_renderer_.endFrame();
|
||||
}
|
||||
|
||||
void SDLManager::updateColors(float delta_time) {
|
||||
// No-op desde la migración a postpro. La oscilación de brillo y el pulso
|
||||
// de fondo los aplica shaders/postfx.frag.glsl directamente sobre wall-clock.
|
||||
(void)delta_time;
|
||||
}
|
||||
|
||||
void SDLManager::updateFPS(float delta_time) {
|
||||
fps_accumulator_ += delta_time;
|
||||
fps_frame_count_++;
|
||||
|
||||
if (fps_accumulator_ >= 0.5F) {
|
||||
fps_display_ = static_cast<int>(fps_frame_count_ / fps_accumulator_);
|
||||
fps_frame_count_ = 0;
|
||||
fps_accumulator_ = 0.0F;
|
||||
|
||||
std::string vsync_state = (Options::rendering.vsync == 1) ? "ON" : "OFF";
|
||||
std::string title = std::format("{} v{} ({}) - {} FPS - VSync: {}",
|
||||
Project::LONG_NAME,
|
||||
Project::VERSION,
|
||||
Project::COPYRIGHT,
|
||||
fps_display_,
|
||||
vsync_state);
|
||||
|
||||
if (finestra_ != nullptr) {
|
||||
SDL_SetWindowTitle(finestra_, title.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SDLManager::setWindowTitle(const std::string& title) {
|
||||
if (finestra_ != nullptr) {
|
||||
SDL_SetWindowTitle(finestra_, title.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void SDLManager::toggleVSync() {
|
||||
Options::rendering.vsync = (Options::rendering.vsync == 1) ? 0 : 1;
|
||||
gpu_renderer_.setVSync(Options::rendering.vsync != 0);
|
||||
|
||||
fps_accumulator_ = 0.0F;
|
||||
fps_frame_count_ = 0;
|
||||
|
||||
Options::saveToFile();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user