RenderInfo amb tres estats (off/dalt/baix), temps de joc i persistència; ombra, mono-dígits i easing compartits (v0.14.0)
This commit is contained in:
1 parent
46a578fd86
commit
6f3fafbfff
17 files changed
+376
-97
No files matched your search
+26
-2
@@ -43,6 +43,24 @@ namespace {
|
||||
return text == "linear" ? Defaults::TextureFilter::LINEAR : Defaults::TextureFilter::NEAREST;
|
||||
}
|
||||
|
||||
auto renderInfoPositionToString(Defaults::RenderInfoPosition pos) -> const char* {
|
||||
switch (pos) {
|
||||
case Defaults::RenderInfoPosition::TOP:
|
||||
return "top";
|
||||
case Defaults::RenderInfoPosition::BOTTOM:
|
||||
return "bottom";
|
||||
case Defaults::RenderInfoPosition::OFF:
|
||||
return "off";
|
||||
}
|
||||
return "off";
|
||||
}
|
||||
|
||||
auto renderInfoPositionFromString(const std::string& text) -> Defaults::RenderInfoPosition {
|
||||
if (text == "top") { return Defaults::RenderInfoPosition::TOP; }
|
||||
if (text == "bottom") { return Defaults::RenderInfoPosition::BOTTOM; }
|
||||
return Defaults::RenderInfoPosition::OFF;
|
||||
}
|
||||
|
||||
auto readFileOrEmpty(const std::string& path) -> std::string {
|
||||
std::ifstream file(path);
|
||||
if (!file) { return {}; }
|
||||
@@ -97,7 +115,12 @@ namespace {
|
||||
if (node.contains("texture_filter")) {
|
||||
Options::video.texture_filter = filterFromString(node["texture_filter"].get_value<std::string>());
|
||||
}
|
||||
if (node.contains("render_info")) { Options::video.render_info = node["render_info"].get_value<bool>(); }
|
||||
if (node.contains("render_info_position")) {
|
||||
Options::video.render_info_position = renderInfoPositionFromString(node["render_info_position"].get_value<std::string>());
|
||||
}
|
||||
if (node.contains("render_info_show_time")) {
|
||||
Options::video.render_info_show_time = node["render_info_show_time"].get_value<bool>();
|
||||
}
|
||||
parseGpu(node);
|
||||
parseShader(node);
|
||||
}
|
||||
@@ -370,7 +393,8 @@ namespace Options {
|
||||
out << " vsync: " << (video.vsync ? "true" : "false") << "\n";
|
||||
out << " scaling_mode: \"" << scalingModeToString(video.scaling_mode) << "\"\n";
|
||||
out << " texture_filter: \"" << filterToString(video.texture_filter) << "\"\n";
|
||||
out << " render_info: " << (video.render_info ? "true" : "false") << "\n";
|
||||
out << " render_info_position: \"" << renderInfoPositionToString(video.render_info_position) << "\"\n";
|
||||
out << " render_info_show_time: " << (video.render_info_show_time ? "true" : "false") << "\n";
|
||||
out << " gpu:\n";
|
||||
out << " acceleration: " << (video.gpu.acceleration ? "true" : "false") << "\n";
|
||||
out << " preferred_driver: \"" << video.gpu.preferred_driver << "\"\n";
|
||||
|
||||
@@ -34,7 +34,8 @@ namespace Options {
|
||||
bool vsync{Defaults::Video::VSYNC};
|
||||
Defaults::ScalingMode scaling_mode{Defaults::Video::SCALING_MODE};
|
||||
Defaults::TextureFilter texture_filter{Defaults::Video::TEXTURE_FILTER};
|
||||
bool render_info{Defaults::Video::RENDER_INFO};
|
||||
Defaults::RenderInfoPosition render_info_position{Defaults::Video::RENDER_INFO_POSITION};
|
||||
bool render_info_show_time{Defaults::Video::RENDER_INFO_SHOW_TIME};
|
||||
Gpu gpu{};
|
||||
Shader shader{};
|
||||
};
|
||||
|
||||
@@ -19,9 +19,19 @@ namespace Notification {
|
||||
// Per a ajustar l'aparença global de totes les notificacions sense
|
||||
// presetejar-les manualment, toca només aquest bloc.
|
||||
constexpr Preset DEFAULT{
|
||||
.text_color = 15,
|
||||
.bg_color = 0,
|
||||
.time_ms = 2000,
|
||||
.text_color = 197,
|
||||
.bg_color = 96,
|
||||
.time_ms = 4000,
|
||||
};
|
||||
|
||||
// Preset per al missatge de confirmació d'eixida (ESC doble). Color
|
||||
// d'accent per a distingir-lo d'una notificació informativa; la durada
|
||||
// coincideix amb la finestra durant la qual la segona pulsació d'ESC
|
||||
// confirma el tancament — veure GlobalInputs::onExit.
|
||||
constexpr Preset EXIT{
|
||||
.text_color = 88,
|
||||
.bg_color = 40,
|
||||
.time_ms = 4000,
|
||||
};
|
||||
|
||||
} // namespace Notification
|
||||
@@ -8,9 +8,13 @@
|
||||
// requereix canviar la seua constant ací — no cal buscar l'índex pel codi.
|
||||
namespace UiColor {
|
||||
|
||||
// Color per al text de l'overlay de debug RenderInfo (F3).
|
||||
// Color per al text de l'overlay de debug RenderInfo (F12).
|
||||
constexpr Uint8 RENDER_INFO_TEXT = 47;
|
||||
|
||||
// Ombra desplaçada (+1, +1) per al mateix overlay. Fosca per a donar
|
||||
// contrast amb qualsevol fons sense haver de pintar una caixa.
|
||||
constexpr Uint8 RENDER_INFO_SHADOW = 34;
|
||||
|
||||
// Color de fons del canvas del joc quan no hi ha escena pintada a tota
|
||||
// la superfície. Útil per a distingir la zona interior del joc en
|
||||
// escalats que deixen banda negra (letterbox, integer, ...).
|
||||
|
||||
Reference in new issue
Block a user