afegits metodes per a poder ciclar presets i altres opcions
esc en el joc + menu ja no tanca la app
This commit is contained in:
@@ -19,17 +19,17 @@ namespace Menu {
|
||||
|
||||
static constexpr int BOX_W = 220;
|
||||
static constexpr int BOX_H = 150;
|
||||
static constexpr int BOX_X = (SCREEN_W - BOX_W) / 2; // 50
|
||||
static constexpr int BOX_Y = (SCREEN_H - BOX_H) / 2; // 25
|
||||
static constexpr int BOX_X = (SCREEN_W - BOX_W) / 2; // 50
|
||||
static constexpr int BOX_Y = (SCREEN_H - BOX_H) / 2; // 25
|
||||
|
||||
static constexpr Uint32 BG_COLOR = 0xFF1A0E0E; // fons marró fosc (ABGR)
|
||||
static constexpr Uint8 BG_ALPHA = 220; // semi-transparent
|
||||
static constexpr Uint32 BORDER_COLOR = 0xFFFFFF00; // cyan
|
||||
static constexpr Uint32 TITLE_COLOR = 0xFFFFFFFF; // blanc
|
||||
static constexpr Uint32 LABEL_COLOR = 0xFFCCCCCC; // gris clar
|
||||
static constexpr Uint32 VALUE_COLOR = 0xFFFFFF00; // cyan
|
||||
static constexpr Uint32 CURSOR_COLOR = 0xFF00FFFF; // groc
|
||||
static constexpr Uint32 FOOTER_COLOR = 0xFF888888; // gris
|
||||
static constexpr Uint32 BG_COLOR = 0xFF1A0E0E; // fons marró fosc (ABGR)
|
||||
static constexpr Uint8 BG_ALPHA = 220; // semi-transparent
|
||||
static constexpr Uint32 BORDER_COLOR = 0xFFFFFF00; // cyan
|
||||
static constexpr Uint32 TITLE_COLOR = 0xFFFFFFFF; // blanc
|
||||
static constexpr Uint32 LABEL_COLOR = 0xFFCCCCCC; // gris clar
|
||||
static constexpr Uint32 VALUE_COLOR = 0xFFFFFF00; // cyan
|
||||
static constexpr Uint32 CURSOR_COLOR = 0xFF00FFFF; // groc
|
||||
static constexpr Uint32 FOOTER_COLOR = 0xFF888888; // gris
|
||||
|
||||
static constexpr int TITLE_PAD_Y = 4;
|
||||
static constexpr int ITEM_PAD_X = 10;
|
||||
@@ -64,63 +64,46 @@ namespace Menu {
|
||||
items_.clear();
|
||||
|
||||
// ZOOM
|
||||
items_.push_back({"ZOOM", ItemKind::IntRange,
|
||||
[] {
|
||||
items_.push_back({"ZOOM", ItemKind::IntRange, [] {
|
||||
char buf[16];
|
||||
std::snprintf(buf, sizeof(buf), "%dX", Screen::get()->getZoom());
|
||||
return std::string(buf);
|
||||
},
|
||||
[](int dir) {
|
||||
return std::string(buf); }, [](int dir) {
|
||||
if (dir < 0) Screen::get()->decZoom();
|
||||
else if (dir > 0) Screen::get()->incZoom();
|
||||
}});
|
||||
else if (dir > 0) Screen::get()->incZoom(); }});
|
||||
|
||||
// PANTALLA (fullscreen)
|
||||
items_.push_back({"PANTALLA", ItemKind::Toggle,
|
||||
[] { return std::string(Screen::get()->isFullscreen() ? "COMPLETA" : "FINESTRA"); },
|
||||
[](int) { Screen::get()->toggleFullscreen(); }});
|
||||
items_.push_back({"PANTALLA", ItemKind::Toggle, [] { return std::string(Screen::get()->isFullscreen() ? "COMPLETA" : "FINESTRA"); }, [](int) { Screen::get()->toggleFullscreen(); }});
|
||||
|
||||
// SHADER
|
||||
items_.push_back({"SHADER", ItemKind::Toggle,
|
||||
[] { return onOff(Options::video.shader_enabled); },
|
||||
[](int) { Screen::get()->toggleShaders(); }});
|
||||
items_.push_back({"SHADER", ItemKind::Toggle, [] { return onOff(Options::video.shader_enabled); }, [](int) { Screen::get()->toggleShaders(); }});
|
||||
|
||||
// ASPECTE 4:3
|
||||
items_.push_back({"ASPECTE 4:3", ItemKind::Toggle,
|
||||
[] { return yesNo(Options::video.aspect_ratio_4_3); },
|
||||
[](int) { Screen::get()->toggleAspectRatio(); }});
|
||||
items_.push_back({"ASPECTE 4:3", ItemKind::Toggle, [] { return yesNo(Options::video.aspect_ratio_4_3); }, [](int) { Screen::get()->toggleAspectRatio(); }});
|
||||
|
||||
// SUPERSAMPLING
|
||||
items_.push_back({"SUPERSAMPLING", ItemKind::Toggle,
|
||||
[] { return onOff(Options::video.supersampling); },
|
||||
[](int) { Screen::get()->toggleSupersampling(); }});
|
||||
items_.push_back({"SUPERSAMPLING", ItemKind::Toggle, [] { return onOff(Options::video.supersampling); }, [](int) { Screen::get()->toggleSupersampling(); }});
|
||||
|
||||
// TIPUS SHADER
|
||||
items_.push_back({"TIPUS SHADER", ItemKind::Cycle,
|
||||
[] { return std::string(Screen::get()->getActiveShaderName()); },
|
||||
[](int) { Screen::get()->nextShaderType(); }});
|
||||
items_.push_back({"TIPUS SHADER", ItemKind::Cycle, [] { return std::string(Screen::get()->getActiveShaderName()); }, [](int dir) {
|
||||
if (dir < 0) Screen::get()->prevShaderType();
|
||||
else Screen::get()->nextShaderType(); }});
|
||||
|
||||
// PRESET
|
||||
items_.push_back({"PRESET", ItemKind::Cycle,
|
||||
[] { return std::string(Screen::get()->getCurrentPresetName()); },
|
||||
[](int) { Screen::get()->nextPreset(); }});
|
||||
items_.push_back({"PRESET", ItemKind::Cycle, [] { return std::string(Screen::get()->getCurrentPresetName()); }, [](int dir) {
|
||||
if (dir < 0) Screen::get()->prevPreset();
|
||||
else Screen::get()->nextPreset(); }});
|
||||
|
||||
// FILTRE 4:3
|
||||
items_.push_back({"FILTRE 4:3", ItemKind::Toggle,
|
||||
[] { return std::string(Options::video.stretch_filter_linear ? "LINEAR" : "NEAREST"); },
|
||||
[](int) { Screen::get()->toggleStretchFilter(); }});
|
||||
items_.push_back({"FILTRE 4:3", ItemKind::Toggle, [] { return std::string(Options::video.stretch_filter_linear ? "LINEAR" : "NEAREST"); }, [](int) { Screen::get()->toggleStretchFilter(); }});
|
||||
|
||||
// RENDER INFO
|
||||
items_.push_back({"RENDER INFO", ItemKind::Cycle,
|
||||
[] {
|
||||
items_.push_back({"RENDER INFO", ItemKind::Cycle, [] {
|
||||
switch (Options::render_info.position) {
|
||||
case Options::RenderInfoPosition::OFF: return std::string("OFF");
|
||||
case Options::RenderInfoPosition::TOP: return std::string("TOP");
|
||||
case Options::RenderInfoPosition::BOTTOM: return std::string("BOTTOM");
|
||||
}
|
||||
return std::string("OFF");
|
||||
},
|
||||
[](int) { Overlay::toggleRenderInfo(); }});
|
||||
return std::string("OFF"); }, [](int dir) { Overlay::cycleRenderInfo(dir); }});
|
||||
}
|
||||
|
||||
// --- Dibuix ---
|
||||
@@ -161,10 +144,10 @@ namespace Menu {
|
||||
}
|
||||
|
||||
static void drawBorder(Uint32* buf, int x, int y, int w, int h, Uint32 color) {
|
||||
fillRect(buf, x, y, w, 1, color); // top
|
||||
fillRect(buf, x, y + h - 1, w, 1, color); // bottom
|
||||
fillRect(buf, x, y, 1, h, color); // left
|
||||
fillRect(buf, x + w - 1, y, 1, h, color); // right
|
||||
fillRect(buf, x, y, w, 1, color); // top
|
||||
fillRect(buf, x, y + h - 1, w, 1, color); // bottom
|
||||
fillRect(buf, x, y, 1, h, color); // left
|
||||
fillRect(buf, x + w - 1, y, 1, h, color); // right
|
||||
}
|
||||
|
||||
// --- API pública ---
|
||||
|
||||
Reference in New Issue
Block a user