skins: SkinManager + hot-swap (F7), classic/nes a data/skins/

This commit is contained in:
2026-05-17 19:54:07 +02:00
parent a40931c7ca
commit ebfcad6f22
125 changed files with 962 additions and 76 deletions
+16
View File
@@ -5,6 +5,8 @@
#include "core/input/input.h"
#include "core/locale/lang.h"
#include "core/rendering/screen.h"
#include "core/resources/resource.h"
#include "core/resources/skin_manager.hpp"
#include "game/options.hpp"
#include "utils/utils.h"
@@ -18,6 +20,7 @@ namespace GlobalInputs {
constexpr int LANG_SHADER = 99;
constexpr int LANG_PRESET = 100;
constexpr int LANG_EXIT_CONFIRM = 101;
constexpr int LANG_SKIN = 102;
constexpr Uint32 NOTIFY_MS = 1500;
constexpr Uint32 EXIT_CONFIRM_MS = 2000;
@@ -63,6 +66,11 @@ namespace GlobalInputs {
Screen::get()->notify(MSG, GREEN, BLACK, NOTIFY_MS);
}
void notifySkin() {
const std::string MSG = Lang::get()->getText(LANG_SKIN) + " " + SkinManager::get()->currentDisplayName();
Screen::get()->notify(MSG, CYAN, BLACK, NOTIFY_MS);
}
void onExit() {
const Uint32 NOW = SDL_GetTicks();
if (NOW < exit_window_until_ticks) {
@@ -117,6 +125,14 @@ namespace GlobalInputs {
return true;
}
}
if (Input::get()->checkInput(Input::Action::NEXT_SKIN, Input::Repeat::OFF)) {
const std::string NEXT_ID = SkinManager::get()->nextSkinId();
if (NEXT_ID != SkinManager::get()->current()) {
Resource::get()->reloadForSkin(NEXT_ID);
}
notifySkin();
return true;
}
return false;
}