corregit el comptador de FPS
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -17,12 +17,17 @@ asteroids
|
|||||||
*.exe
|
*.exe
|
||||||
*.out
|
*.out
|
||||||
*.app
|
*.app
|
||||||
|
tools/pack_resources/pack_resources
|
||||||
|
tools/pack_resources/pack_resources.exe
|
||||||
|
|
||||||
# Releases
|
# Releases
|
||||||
*.zip
|
*.zip
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
*.dmg
|
*.dmg
|
||||||
|
|
||||||
|
# Generated resources
|
||||||
|
resources.pack
|
||||||
|
|
||||||
# Compiled Object files
|
# Compiled Object files
|
||||||
*.o
|
*.o
|
||||||
*.obj
|
*.obj
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -81,8 +81,8 @@ resources.pack: pack_tool
|
|||||||
# BUILD TARGETS (delegate to CMake)
|
# BUILD TARGETS (delegate to CMake)
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# Default target: build with CMake
|
# Default target: build with CMake + resources
|
||||||
all: $(TARGET_FILE)
|
all: resources.pack $(TARGET_FILE)
|
||||||
|
|
||||||
$(TARGET_FILE):
|
$(TARGET_FILE):
|
||||||
@cmake -B build -DCMAKE_BUILD_TYPE=Release
|
@cmake -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
|||||||
BIN
resources.pack
BIN
resources.pack
Binary file not shown.
@@ -433,11 +433,13 @@ void SDLManager::updateFPS(float delta_time) {
|
|||||||
fps_accumulator_ = 0.0f;
|
fps_accumulator_ = 0.0f;
|
||||||
|
|
||||||
// Actualitzar títol de la finestra
|
// Actualitzar títol de la finestra
|
||||||
std::string title = std::format("{} v{} ({}) - {} FPS",
|
std::string vsync_state = (Options::rendering.vsync == 1) ? "ON" : "OFF";
|
||||||
|
std::string title = std::format("{} v{} ({}) - {} FPS - VSync: {}",
|
||||||
Project::LONG_NAME,
|
Project::LONG_NAME,
|
||||||
Project::VERSION,
|
Project::VERSION,
|
||||||
Project::COPYRIGHT,
|
Project::COPYRIGHT,
|
||||||
fps_display_);
|
fps_display_,
|
||||||
|
vsync_state);
|
||||||
|
|
||||||
if (finestra_) {
|
if (finestra_) {
|
||||||
SDL_SetWindowTitle(finestra_, title.c_str());
|
SDL_SetWindowTitle(finestra_, title.c_str());
|
||||||
@@ -462,6 +464,10 @@ void SDLManager::toggleVSync() {
|
|||||||
SDL_SetRenderVSync(renderer_, Options::rendering.vsync);
|
SDL_SetRenderVSync(renderer_, Options::rendering.vsync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset FPS counter para evitar valores mixtos entre regímenes
|
||||||
|
fps_accumulator_ = 0.0f;
|
||||||
|
fps_frame_count_ = 0;
|
||||||
|
|
||||||
// Guardar configuració
|
// Guardar configuració
|
||||||
Options::saveToFile();
|
Options::saveToFile();
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user