feat(ui): captura F9, tema a data/ui.yaml i retocs estètics
Captura de pantalla amb F9: volca el canvas ARGB a screenshots/scr_<timestamp>.png via stb_image_write. Tot el tema d'UI (colors, timings, fonts, flag hud.bg_enabled) passa a data/ui.yaml via UiConfig; els valors de Defaults::UI queden com a fallbacks si el fitxer falta o li manca alguna clau. Retocs estètics: paleta "uzebox" per a la UI, strings del HUD (P1/P2/V/T/PIRAMIDE/SALA) traduïts a locale, i fons del marcador opcional amb backdrop continu de franja per evitar el trencament visual durant el shake o l'animació d'entrada dels panells.
This commit is contained in:
1 parent
82b229222f
commit
dc8a7723e3
26 files changed
+2593
-210
No files matched your search
@@ -11,7 +11,9 @@
|
||||
#include "core/rendering/notifier.hpp"
|
||||
#include "core/rendering/render_info.hpp"
|
||||
#include "core/rendering/screen.hpp"
|
||||
#include "core/rendering/screenshot.hpp"
|
||||
#include "core/system/event_buffer.hpp"
|
||||
#include "core/ui/ui_config.hpp"
|
||||
#include "game/options.hpp"
|
||||
#include "game/options_apply.hpp"
|
||||
#include "utils/defaults.hpp"
|
||||
@@ -24,7 +26,7 @@ namespace GlobalInputs {
|
||||
// La lliguem a la durada de la notificació EXIT perquè el missatge i
|
||||
// la confirmació expiren alhora — si no, l'usuari podria veure el
|
||||
// text però ja no ser dins del rang de confirmació (o al revés).
|
||||
constexpr float EXIT_WINDOW_S = static_cast<float>(Notification::EXIT.time_ms) / 1000.0F;
|
||||
// El valor concret viu a data/ui.yaml (timings.exit_ms) via UiConfig.
|
||||
constexpr int MIN_ZOOM = 1;
|
||||
constexpr int MAX_ZOOM = 6;
|
||||
|
||||
@@ -67,6 +69,18 @@ namespace GlobalInputs {
|
||||
notifyLocale(NEW_VSYNC ? "input.vsync_on" : "input.vsync_off");
|
||||
}
|
||||
|
||||
// Volca el canvas ARGB actual a PNG dins de `screenshots/`. Si ha
|
||||
// fallat l'escriptura, el handler no mostra notificació (retorn buit).
|
||||
void onScreenshot() {
|
||||
const auto* buffer = Screen::get().getCanvasArgb();
|
||||
const int W = Screen::get().getCanvasWidth();
|
||||
const int H = Screen::get().getCanvasHeight();
|
||||
const std::string FILENAME = Screenshot::save(buffer, W, H);
|
||||
if (!FILENAME.empty()) {
|
||||
Notification::notify(Locale::get().text("input.screenshot") + ' ' + FILENAME);
|
||||
}
|
||||
}
|
||||
|
||||
void onToggleShader() {
|
||||
const bool NEW_ENABLED = !Options::video().shader.enabled;
|
||||
Options::setShaderEnabled(NEW_ENABLED);
|
||||
@@ -140,17 +154,13 @@ namespace GlobalInputs {
|
||||
Options::setVideoRenderInfoPosition(static_cast<Defaults::RenderInfoPosition>(NEXT));
|
||||
}
|
||||
|
||||
void onToggleRenderTime() {
|
||||
Options::setVideoRenderInfoShowTime(!Options::video().render_info_show_time);
|
||||
}
|
||||
|
||||
void onExit() {
|
||||
if (exit_window_s > 0.0F) {
|
||||
quit_requested = true;
|
||||
return;
|
||||
}
|
||||
exit_window_s = EXIT_WINDOW_S;
|
||||
Notification::notify(Locale::get().text("input.press_again_exit"), Notification::EXIT);
|
||||
exit_window_s = static_cast<float>(UiConfig::get().exitMs()) / 1000.0F;
|
||||
Notification::notify(Locale::get().text("input.press_again_exit"), Notification::exitPreset());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -171,6 +181,8 @@ namespace GlobalInputs {
|
||||
onToggleShader();
|
||||
} else if (SC == KeyConfig::get().scancode("toggle_vsync")) {
|
||||
onToggleVSync();
|
||||
} else if (SC == KeyConfig::get().scancode("screenshot")) {
|
||||
onScreenshot();
|
||||
} else if (SC == KeyConfig::get().scancode("next_shader")) {
|
||||
onNextShader();
|
||||
} else if (SC == KeyConfig::get().scancode("next_preset")) {
|
||||
@@ -179,8 +191,6 @@ namespace GlobalInputs {
|
||||
onNextScalingMode();
|
||||
} else if (SC == KeyConfig::get().scancode("toggle_render_info")) {
|
||||
onCycleRenderInfo();
|
||||
} else if (SC == KeyConfig::get().scancode("toggle_render_time")) {
|
||||
onToggleRenderTime();
|
||||
} else if (SC == KeyConfig::get().scancode("exit")) {
|
||||
onExit();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user