animacions a renderinfo

This commit is contained in:
2026-04-05 01:03:48 +02:00
parent 91f88ded09
commit 4238ae1bc4
9 changed files with 181 additions and 32 deletions

View File

@@ -329,25 +329,34 @@ auto Screen::getActiveShaderName() const -> const char* {
void Screen::updateRenderInfo() {
static const Uint32 start_ticks = SDL_GetTicks();
std::string driver = gpu_driver_.empty() ? "sdl" : toLower(gpu_driver_);
std::string info = std::to_string(fps_.last_value) + " fps - " + driver;
// Segment 0: FPS + driver (sempre visible)
std::string fps_driver = std::to_string(fps_.last_value) + " fps - " + driver;
// Segment 1: shader + preset (només si shaders actius)
std::string shader_seg;
if (Options::video.shader_enabled) {
std::string shader_name = toLower(getActiveShaderName());
std::string preset_name = toLower(getCurrentPresetName());
info += " - " + shader_name + " " + preset_name;
if (Options::video.supersampling) info += " (ss)";
shader_seg = " - " + toLower(getActiveShaderName()) + " " + toLower(getCurrentPresetName());
}
// Temps de joc: m:ss.cc
Uint32 elapsed = SDL_GetTicks() - start_ticks;
int minutes = elapsed / 60000;
int seconds = (elapsed / 1000) % 60;
int centis = (elapsed / 10) % 100;
char time_buf[32];
snprintf(time_buf, sizeof(time_buf), " - %d:%02d.%02d", minutes, seconds, centis);
info += time_buf;
// Segment 2: supersampling indicator
const char* ss_seg = (Options::video.shader_enabled && Options::video.supersampling) ? " (ss)" : nullptr;
Overlay::setRenderInfoText(info.c_str());
// Segment 3: hora (només si show_time)
char time_buf[32] = {0};
if (Options::render_info.show_time) {
Uint32 elapsed = SDL_GetTicks() - start_ticks;
int minutes = elapsed / 60000;
int seconds = (elapsed / 1000) % 60;
int centis = (elapsed / 10) % 100;
snprintf(time_buf, sizeof(time_buf), " - %d:%02d.%02d", minutes, seconds, centis);
}
Overlay::setRenderInfoSegments(
fps_driver.c_str(),
shader_seg.empty() ? nullptr : shader_seg.c_str(),
ss_seg,
time_buf[0] ? time_buf : nullptr);
}
void Screen::adjustWindowSize() {