notificacions: paleta semàntica pastel centralitzada amb outline derivat
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
|
||||
#include "core/input/input.h"
|
||||
#include "core/locale/lang.h"
|
||||
#include "core/rendering/notifications.hpp"
|
||||
#include "core/rendering/screen.h"
|
||||
#include "game/options.hpp"
|
||||
#include "utils/utils.h"
|
||||
|
||||
namespace GlobalInputs {
|
||||
|
||||
@@ -19,15 +19,6 @@ namespace GlobalInputs {
|
||||
constexpr int LANG_PRESET = 100;
|
||||
constexpr int LANG_EXIT_CONFIRM = 101;
|
||||
|
||||
constexpr Uint32 NOTIFY_MS = 1500;
|
||||
constexpr Uint32 EXIT_CONFIRM_MS = 2000;
|
||||
const Color BLACK = {0x00, 0x00, 0x00};
|
||||
const Color CYAN = {0x00, 0xFF, 0xFF};
|
||||
const Color YELLOW = {0xFF, 0xE0, 0x40};
|
||||
const Color MAGENTA = {0xFF, 0x00, 0xFF};
|
||||
const Color GREEN = {0x00, 0xFF, 0x80};
|
||||
const Color RED = {0xFF, 0x40, 0x40};
|
||||
|
||||
// Patró de doble pulsació: la primera pulsació d'EXIT mostra una
|
||||
// notificació en vermell i obre una finestra de confirmació; una
|
||||
// segona pulsació dins la finestra activa `quit_requested`. La
|
||||
@@ -38,29 +29,29 @@ namespace GlobalInputs {
|
||||
|
||||
void notifyZoom() {
|
||||
const std::string MSG = Lang::get()->getText(LANG_ZOOM) + " " + std::to_string(Options::window.zoom) + "x";
|
||||
Screen::get()->notify(MSG, YELLOW, BLACK, NOTIFY_MS);
|
||||
Notifications::show(MSG, Notifications::Palette::INFO, Notifications::STANDARD_MS);
|
||||
}
|
||||
|
||||
void notifyFullscreen() {
|
||||
const int IDX = Options::video.fullscreen ? LANG_FULLSCREEN : LANG_WINDOW;
|
||||
Screen::get()->notify(Lang::get()->getText(IDX), YELLOW, BLACK, NOTIFY_MS);
|
||||
Notifications::show(Lang::get()->getText(IDX), Notifications::Palette::INFO, Notifications::STANDARD_MS);
|
||||
}
|
||||
|
||||
void notifyShaderEnabled() {
|
||||
const std::string STATE = Screen::isShaderEnabled() ? "ON" : "OFF";
|
||||
const std::string MSG = Lang::get()->getText(LANG_SHADER) + " " + STATE;
|
||||
Screen::get()->notify(MSG, CYAN, BLACK, NOTIFY_MS);
|
||||
Notifications::show(MSG, Notifications::Palette::TOGGLE, Notifications::STANDARD_MS);
|
||||
}
|
||||
|
||||
void notifyShaderType() {
|
||||
const bool IS_CRTPI = Options::video.shader.current_shader == Rendering::ShaderType::CRTPI;
|
||||
const std::string MSG = Lang::get()->getText(LANG_SHADER) + " " + (IS_CRTPI ? "CRTPI" : "POSTFX");
|
||||
Screen::get()->notify(MSG, MAGENTA, BLACK, NOTIFY_MS);
|
||||
Notifications::show(MSG, Notifications::Palette::CHOICE, Notifications::STANDARD_MS);
|
||||
}
|
||||
|
||||
void notifyPreset() {
|
||||
const std::string MSG = Lang::get()->getText(LANG_PRESET) + " " + Screen::get()->getCurrentPresetName();
|
||||
Screen::get()->notify(MSG, GREEN, BLACK, NOTIFY_MS);
|
||||
Notifications::show(MSG, Notifications::Palette::SUCCESS, Notifications::STANDARD_MS);
|
||||
}
|
||||
|
||||
void onExit() {
|
||||
@@ -69,8 +60,8 @@ namespace GlobalInputs {
|
||||
quit_requested = true;
|
||||
return;
|
||||
}
|
||||
exit_window_until_ticks = NOW + EXIT_CONFIRM_MS;
|
||||
Screen::get()->notify(Lang::get()->getText(LANG_EXIT_CONFIRM), RED, BLACK, EXIT_CONFIRM_MS);
|
||||
exit_window_until_ticks = NOW + Notifications::CONFIRM_MS;
|
||||
Notifications::show(Lang::get()->getText(LANG_EXIT_CONFIRM), Notifications::Palette::DANGER, Notifications::CONFIRM_MS);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user