refactor(core/rendering): desacoplar RenderInfo d'Options i UiColor (COUP-01b)
core/rendering/render_info ja no inclou game/options.hpp ni
game/ui/ui_palette.hpp. S'introdueix RenderInfo::Frame amb tot l'estat
extern (posició, show_time, shader_enabled, shader_name, shader_preset,
colors) que el caller injecta a cada init()/update(). La lògica de
persistència (cyclePosition/toggleShowTime) surt de RenderInfo i passa
a global_inputs.cpp, que muta Options i crida saveToFile() directament.
Options::buildRenderInfoFrame(text_color, shadow_color) centralitza la
construcció del Frame seguint el mateix patró que buildScreenConfig /
buildPostFXParams. Director i GameScene criden aquest builder quan
necessiten un Frame (amb UiColor::RENDER_INFO_{TEXT,SHADOW} com a
colors actius).
Amb aquest canvi queda tancada COUP-01: core/rendering/ no té cap
include de game/*.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
9434e4e87d
commit
9395520a23
8 files changed
+77
-59
No files matched your search
@@ -18,7 +18,7 @@ Los IDs se mantienen estables una vez asignados. Cada entrada apunta al(los) fic
|
|||||||
|
|
||||||
| ID | Título | Estado |
|
| ID | Título | Estado |
|
||||||
|----|--------|--------|
|
|----|--------|--------|
|
||||||
| COUP-01 | Inversión de dependencia `core/rendering → game/*` | WIP (a: DONE, b: PENDING) |
|
| COUP-01 | Inversión de dependencia `core/rendering → game/*` | DONE |
|
||||||
| DUP-02 | `Surface::render` / `renderWithColorReplace` duplicados | PENDING |
|
| DUP-02 | `Surface::render` / `renderWithColorReplace` duplicados | PENDING |
|
||||||
| CONV-03 | Shaders MSL como raw strings en `.cpp` + helpers duplicados | PENDING |
|
| CONV-03 | Shaders MSL como raw strings en `.cpp` + helpers duplicados | PENDING |
|
||||||
| DUP-03 | Familia `Text::write*` con bucle UTF-8 repetido 5 veces | PENDING |
|
| DUP-03 | Familia `Text::write*` con bucle UTF-8 repetido 5 veces | PENDING |
|
||||||
@@ -71,7 +71,7 @@ Los IDs se mantienen estables una vez asignados. Cada entrada apunta al(los) fic
|
|||||||
| ID | Fichero:línea | Hallazgo | Severidad | Estado | Notas |
|
| ID | Fichero:línea | Hallazgo | Severidad | Estado | Notas |
|
||||||
|----|---------------|----------|-----------|--------|-------|
|
|----|---------------|----------|-----------|--------|-------|
|
||||||
| COUP-01a | `notifier.hpp:9` | `core/rendering/notifier.hpp` incluye `game/ui/notification_presets.hpp` | Crítico | DONE | helper `Notification::notify()` en `game/ui` |
|
| COUP-01a | `notifier.hpp:9` | `core/rendering/notifier.hpp` incluye `game/ui/notification_presets.hpp` | Crítico | DONE | helper `Notification::notify()` en `game/ui` |
|
||||||
| COUP-01b | `render_info.cpp:12-13` | `core/rendering/render_info.cpp` incluye `game/options.hpp` + `game/ui/ui_palette.hpp` | Crítico | PENDING | `RenderInfo::State` inyectada pel Director |
|
| COUP-01b | `render_info.cpp:12-13` | `core/rendering/render_info.cpp` incluye `game/options.hpp` + `game/ui/ui_palette.hpp` | Crítico | DONE | `RenderInfo::Frame` injectada; Options.buildRenderInfoFrame() |
|
||||||
| COUP-02 | `screen.cpp:13-14,109` | `Screen` instancia `SDL3GPUShader` concreto | Importante | PENDING | factory/registry |
|
| COUP-02 | `screen.cpp:13-14,109` | `Screen` instancia `SDL3GPUShader` concreto | Importante | PENDING | factory/registry |
|
||||||
| COUP-03 | `surface.cpp:81-83,110-112` | `Surface::render` usa `Screen::get()` global | Importante | PENDING | pasar destino por parámetro |
|
| COUP-03 | `surface.cpp:81-83,110-112` | `Surface::render` usa `Screen::get()` global | Importante | PENDING | pasar destino por parámetro |
|
||||||
| COUP-04 | `notifier.cpp:19`, `render_info.cpp:52` | `Resource::Cache::get().getSurface("8bithud.gif")` con string literal | Importante | PENDING | inyectar la surface |
|
| COUP-04 | `notifier.cpp:19`, `render_info.cpp:52` | `Resource::Cache::get().getSurface("8bithud.gif")` con string literal | Importante | PENDING | inyectar la surface |
|
||||||
@@ -120,4 +120,5 @@ Los IDs se mantienen estables una vez asignados. Cada entrada apunta al(los) fic
|
|||||||
## Registro de commits
|
## Registro de commits
|
||||||
|
|
||||||
- `9243db1` — docs: full de treball inicial (aquest fitxer)
|
- `9243db1` — docs: full de treball inicial (aquest fitxer)
|
||||||
- `<pendent>` — COUP-01a: `Notifier` desacoblat de `game/ui/notification_presets`
|
- `9434e4e` — COUP-01a: `Notifier` desacoblat de `game/ui/notification_presets`
|
||||||
|
- `<pendent>` — COUP-01b: `RenderInfo` desacoblat de `game/options` + `game/ui/ui_palette`
|
||||||
@@ -139,11 +139,14 @@ namespace GlobalInputs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onCycleRenderInfo() {
|
void onCycleRenderInfo() {
|
||||||
RenderInfo::cyclePosition();
|
const int NEXT = (static_cast<int>(Options::video.render_info_position) + 1) % 3;
|
||||||
|
Options::video.render_info_position = static_cast<Defaults::RenderInfoPosition>(NEXT);
|
||||||
|
Options::saveToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onToggleRenderTime() {
|
void onToggleRenderTime() {
|
||||||
RenderInfo::toggleShowTime();
|
Options::video.render_info_show_time = !Options::video.render_info_show_time;
|
||||||
|
Options::saveToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onExit() {
|
void onExit() {
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
#include "core/rendering/screen.hpp"
|
#include "core/rendering/screen.hpp"
|
||||||
#include "core/rendering/text.hpp"
|
#include "core/rendering/text.hpp"
|
||||||
#include "core/resources/resource_cache.hpp"
|
#include "core/resources/resource_cache.hpp"
|
||||||
#include "game/options.hpp"
|
|
||||||
#include "game/ui/ui_palette.hpp"
|
|
||||||
#include "utils/defines.hpp"
|
#include "utils/defines.hpp"
|
||||||
#include "utils/easing.hpp"
|
#include "utils/easing.hpp"
|
||||||
|
|
||||||
@@ -23,6 +21,10 @@ namespace {
|
|||||||
// Evita una fileta d'un sol píxel quan acaba de començar a aparèixer.
|
// Evita una fileta d'un sol píxel quan acaba de començar a aparèixer.
|
||||||
constexpr float VISIBLE_EPSILON = 0.01F;
|
constexpr float VISIBLE_EPSILON = 0.01F;
|
||||||
|
|
||||||
|
// Índex del segment de temps dins de segments_. Si canvia SEGMENT_COUNT
|
||||||
|
// o l'ordre, actualitzar ací.
|
||||||
|
constexpr int TIME_SEGMENT = 3;
|
||||||
|
|
||||||
auto prettify(std::string s) -> std::string {
|
auto prettify(std::string s) -> std::string {
|
||||||
std::ranges::replace(s, '-', ' ');
|
std::ranges::replace(s, '-', ' ');
|
||||||
std::ranges::transform(s, s.begin(), [](unsigned char c) { return std::tolower(c); });
|
std::ranges::transform(s, s.begin(), [](unsigned char c) { return std::tolower(c); });
|
||||||
@@ -48,27 +50,25 @@ auto RenderInfo::get() -> RenderInfo& {
|
|||||||
|
|
||||||
RenderInfo::~RenderInfo() = default;
|
RenderInfo::~RenderInfo() = default;
|
||||||
|
|
||||||
void RenderInfo::init() {
|
void RenderInfo::init(const Frame& initial) {
|
||||||
auto font_surface = Resource::Cache::get().getSurface("8bithud.gif");
|
auto font_surface = Resource::Cache::get().getSurface("8bithud.gif");
|
||||||
text_ = std::make_unique<Text>(font_surface, "data/font/8bithud.fnt");
|
text_ = std::make_unique<Text>(font_surface, "data/font/8bithud.fnt");
|
||||||
|
|
||||||
|
current_ = initial;
|
||||||
|
segments_[TIME_SEGMENT].mono_digits = true;
|
||||||
|
|
||||||
// Restaura l'estat guardat: si l'overlay estava engegat, l'activem ja
|
// Restaura l'estat guardat: si l'overlay estava engegat, l'activem ja
|
||||||
// plenament visible (sense animació d'entrada inicial).
|
// plenament visible (sense animació d'entrada inicial).
|
||||||
if (Options::video.render_info_position != Defaults::RenderInfoPosition::OFF) {
|
if (initial.target_position != Defaults::RenderInfoPosition::OFF) {
|
||||||
visible_pos_ = Options::video.render_info_position;
|
visible_pos_ = initial.target_position;
|
||||||
info_anim_ = 1.0F;
|
info_anim_ = 1.0F;
|
||||||
}
|
|
||||||
|
|
||||||
// El segment de temps pot estar activat per persistència: si la barra
|
|
||||||
// apareix ja plena, el seu segment també ha d'estar-ho.
|
|
||||||
segments_[3].mono_digits = true;
|
|
||||||
if (info_anim_ >= 1.0F) {
|
|
||||||
refreshSegments();
|
refreshSegments();
|
||||||
for (auto& seg : segments_) { seg.anim = seg.visible ? 1.0F : 0.0F; }
|
for (auto& seg : segments_) { seg.anim = seg.visible ? 1.0F : 0.0F; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderInfo::update(int delta_ms) {
|
void RenderInfo::update(int delta_ms, const Frame& frame) {
|
||||||
|
current_ = frame;
|
||||||
elapsed_ms_ += delta_ms;
|
elapsed_ms_ += delta_ms;
|
||||||
const float DT = static_cast<float>(delta_ms) / 1000.0F;
|
const float DT = static_cast<float>(delta_ms) / 1000.0F;
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ void RenderInfo::update(int delta_ms) {
|
|||||||
// visible, entrem (anim→1). Si no, primer eixim (anim→0) del lloc actual;
|
// visible, entrem (anim→1). Si no, primer eixim (anim→0) del lloc actual;
|
||||||
// quan arriba a 0 commutem visible_pos_ i deixem que el proper frame
|
// quan arriba a 0 commutem visible_pos_ i deixem que el proper frame
|
||||||
// dispari l'entrada. Excepció: de OFF a TOP/BOTTOM commutem en sec.
|
// dispari l'entrada. Excepció: de OFF a TOP/BOTTOM commutem en sec.
|
||||||
const auto DESIRED = Options::video.render_info_position;
|
const auto DESIRED = current_.target_position;
|
||||||
if (DESIRED == visible_pos_) {
|
if (DESIRED == visible_pos_) {
|
||||||
// Si el destí és OFF, no cal animar cap a un lloc — la barra ja ha
|
// Si el destí és OFF, no cal animar cap a un lloc — la barra ja ha
|
||||||
// d'estar fora. Sense aquest guard, en arribar de BOTTOM→OFF la
|
// d'estar fora. Sense aquest guard, en arribar de BOTTOM→OFF la
|
||||||
@@ -122,21 +122,18 @@ void RenderInfo::refreshSegments() {
|
|||||||
segments_[1].visible = true;
|
segments_[1].visible = true;
|
||||||
segments_[1].mono_digits = false;
|
segments_[1].mono_digits = false;
|
||||||
|
|
||||||
// [2] Shader + preset (només amb shader activat)
|
// [2] Shader + preset (només amb shader activat). El caller ha triat el
|
||||||
if (Options::video.shader.enabled) {
|
// preset actiu segons el shader; ací només el formatem.
|
||||||
const std::string& shader = Options::video.shader.current_shader;
|
if (current_.shader_enabled) {
|
||||||
const std::string& preset = (shader == "crtpi")
|
segments_[2].text = " | " + current_.shader_name + " " + prettify(current_.shader_preset);
|
||||||
? Options::video.shader.current_crtpi_preset
|
|
||||||
: Options::video.shader.current_postfx_preset;
|
|
||||||
segments_[2].text = " | " + shader + " " + prettify(preset);
|
|
||||||
}
|
}
|
||||||
segments_[2].visible = Options::video.shader.enabled;
|
segments_[2].visible = current_.shader_enabled;
|
||||||
segments_[2].mono_digits = false;
|
segments_[2].mono_digits = false;
|
||||||
|
|
||||||
// [3] Temps de joc (togglejable i persistent)
|
// [3] Temps de joc (togglejable i persistent)
|
||||||
segments_[3].text = " | " + formatTime(elapsed_ms_);
|
segments_[TIME_SEGMENT].text = " | " + formatTime(elapsed_ms_);
|
||||||
segments_[3].visible = Options::video.render_info_show_time;
|
segments_[TIME_SEGMENT].visible = current_.show_time;
|
||||||
segments_[3].mono_digits = true;
|
segments_[TIME_SEGMENT].mono_digits = true;
|
||||||
|
|
||||||
// Els tres primers segments baixem a minúscules per coherència estètica
|
// Els tres primers segments baixem a minúscules per coherència estètica
|
||||||
// amb la resta de la línia; el [3] (temps) manté dígits i puntuació.
|
// amb la resta de la línia; el [3] (temps) manté dígits i puntuació.
|
||||||
@@ -191,25 +188,13 @@ void RenderInfo::render() {
|
|||||||
const int SEG_W = segmentWidth(seg, DIGIT_CELL);
|
const int SEG_W = segmentWidth(seg, DIGIT_CELL);
|
||||||
|
|
||||||
if (seg.mono_digits) {
|
if (seg.mono_digits) {
|
||||||
text_->writeMonoDigits(XI + 1, Y + 1, seg.text, UiColor::RENDER_INFO_SHADOW, DIGIT_CELL);
|
text_->writeMonoDigits(XI + 1, Y + 1, seg.text, current_.shadow_color, DIGIT_CELL);
|
||||||
text_->writeMonoDigits(XI, Y, seg.text, UiColor::RENDER_INFO_TEXT, DIGIT_CELL);
|
text_->writeMonoDigits(XI, Y, seg.text, current_.text_color, DIGIT_CELL);
|
||||||
} else {
|
} else {
|
||||||
text_->writeColored(XI + 1, Y + 1, seg.text, UiColor::RENDER_INFO_SHADOW);
|
text_->writeColored(XI + 1, Y + 1, seg.text, current_.shadow_color);
|
||||||
text_->writeColored(XI, Y, seg.text, UiColor::RENDER_INFO_TEXT);
|
text_->writeColored(XI, Y, seg.text, current_.text_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_x += static_cast<float>(SEG_W) * Easing::outQuad(seg.anim);
|
cur_x += static_cast<float>(SEG_W) * Easing::outQuad(seg.anim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderInfo::cyclePosition() {
|
|
||||||
const auto CURRENT = Options::video.render_info_position;
|
|
||||||
const int NEXT = (static_cast<int>(CURRENT) + 1) % 3;
|
|
||||||
Options::video.render_info_position = static_cast<Defaults::RenderInfoPosition>(NEXT);
|
|
||||||
Options::saveToFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenderInfo::toggleShowTime() {
|
|
||||||
Options::video.render_info_show_time = !Options::video.render_info_show_time;
|
|
||||||
Options::saveToFile();
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -11,9 +13,9 @@ class Text;
|
|||||||
|
|
||||||
// Overlay de debug amb tres estats (OFF / TOP / BOTTOM). Mostra una barra
|
// Overlay de debug amb tres estats (OFF / TOP / BOTTOM). Mostra una barra
|
||||||
// d'info dividida en segments independents (fps, driver, shader, temps) que
|
// d'info dividida en segments independents (fps, driver, shader, temps) que
|
||||||
// apareixen i desapareixen suaument. La posició es commuta amb una tecla
|
// apareixen i desapareixen suaument. No llig cap configuració; el caller
|
||||||
// (cicle OFF → TOP → BOTTOM) i el segment de temps es pot mostrar o amagar
|
// (Director a init, GameScene a update) injecta cada frame l'estat desitjat
|
||||||
// per separat; les dos opcions persisteixen a config.yaml.
|
// via Frame.
|
||||||
class RenderInfo {
|
class RenderInfo {
|
||||||
public:
|
public:
|
||||||
static auto get() -> RenderInfo&;
|
static auto get() -> RenderInfo&;
|
||||||
@@ -23,18 +25,23 @@ class RenderInfo {
|
|||||||
auto operator=(const RenderInfo&) -> RenderInfo& = delete;
|
auto operator=(const RenderInfo&) -> RenderInfo& = delete;
|
||||||
auto operator=(RenderInfo&&) -> RenderInfo& = delete;
|
auto operator=(RenderInfo&&) -> RenderInfo& = delete;
|
||||||
|
|
||||||
void init();
|
// Estat extern que dirigeix què ha de mostrar RenderInfo. La posició
|
||||||
|
// determina si la barra entra per dalt o per baix (o s'amaga). El
|
||||||
|
// shader_preset ja ha d'estar pre-seleccionat (crtpi/postfx) pel caller.
|
||||||
|
struct Frame {
|
||||||
|
Defaults::RenderInfoPosition target_position{Defaults::RenderInfoPosition::OFF};
|
||||||
|
bool show_time{false};
|
||||||
|
bool shader_enabled{false};
|
||||||
|
std::string shader_name;
|
||||||
|
std::string shader_preset;
|
||||||
|
Uint8 text_color{0};
|
||||||
|
Uint8 shadow_color{0};
|
||||||
|
};
|
||||||
|
|
||||||
void update(int delta_ms);
|
void init(const Frame& initial);
|
||||||
|
void update(int delta_ms, const Frame& frame);
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
// Avança la posició OFF → TOP → BOTTOM → OFF i persisteix.
|
|
||||||
static void cyclePosition();
|
|
||||||
|
|
||||||
// Mostra/oculta el segment de temps i persisteix. Només té efecte visual
|
|
||||||
// quan la barra és visible (TOP/BOTTOM).
|
|
||||||
static void toggleShowTime();
|
|
||||||
|
|
||||||
static constexpr int HEIGHT = 10;
|
static constexpr int HEIGHT = 10;
|
||||||
static constexpr float SLIDE_SPEED = 5.0F; // posició global (1/s)
|
static constexpr float SLIDE_SPEED = 5.0F; // posició global (1/s)
|
||||||
static constexpr float SEG_SPEED = 6.0F; // segments individuals (1/s)
|
static constexpr float SEG_SPEED = 6.0F; // segments individuals (1/s)
|
||||||
@@ -60,4 +67,5 @@ class RenderInfo {
|
|||||||
float info_anim_{0.0F}; // 0..1, suavitzat amb outQuad al render
|
float info_anim_{0.0F}; // 0..1, suavitzat amb outQuad al render
|
||||||
std::array<Segment, SEGMENT_COUNT> segments_{};
|
std::array<Segment, SEGMENT_COUNT> segments_{};
|
||||||
int elapsed_ms_{0};
|
int elapsed_ms_{0};
|
||||||
|
Frame current_{};
|
||||||
};
|
};
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "core/system/event_buffer.hpp"
|
#include "core/system/event_buffer.hpp"
|
||||||
#include "game/options.hpp"
|
#include "game/options.hpp"
|
||||||
#include "game/scenes/game_scene.hpp"
|
#include "game/scenes/game_scene.hpp"
|
||||||
|
#include "game/ui/ui_palette.hpp"
|
||||||
#include "utils/defaults.hpp"
|
#include "utils/defaults.hpp"
|
||||||
|
|
||||||
Director::Director() {
|
Director::Director() {
|
||||||
@@ -79,7 +80,7 @@ Director::Director() {
|
|||||||
// JA_Music_t que continga, així que no queden streams orfes.
|
// JA_Music_t que continga, així que no queden streams orfes.
|
||||||
Audio::init(Options::buildAudioConfig());
|
Audio::init(Options::buildAudioConfig());
|
||||||
|
|
||||||
RenderInfo::get().init();
|
RenderInfo::get().init(Options::buildRenderInfoFrame(UiColor::RENDER_INFO_TEXT, UiColor::RENDER_INFO_SHADOW));
|
||||||
Notifier::get().init();
|
Notifier::get().init();
|
||||||
|
|
||||||
current_scene_ = std::make_unique<GameScene>();
|
current_scene_ = std::make_unique<GameScene>();
|
||||||
|
|||||||
@@ -553,6 +553,21 @@ namespace Options {
|
|||||||
return Rendering::ShaderType::POSTFX;
|
return Rendering::ShaderType::POSTFX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto buildRenderInfoFrame(Uint8 text_color, Uint8 shadow_color) -> RenderInfo::Frame {
|
||||||
|
const std::string& active_preset = (video.shader.current_shader == "crtpi")
|
||||||
|
? video.shader.current_crtpi_preset
|
||||||
|
: video.shader.current_postfx_preset;
|
||||||
|
return {
|
||||||
|
.target_position = video.render_info_position,
|
||||||
|
.show_time = video.render_info_show_time,
|
||||||
|
.shader_enabled = video.shader.enabled,
|
||||||
|
.shader_name = video.shader.current_shader,
|
||||||
|
.shader_preset = active_preset,
|
||||||
|
.text_color = text_color,
|
||||||
|
.shadow_color = shadow_color,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
auto buildCrtPiParams() -> Rendering::CrtPiParams {
|
auto buildCrtPiParams() -> Rendering::CrtPiParams {
|
||||||
// Si el shader està deshabilitat, retornem defaults (el dispatch anirà per
|
// Si el shader està deshabilitat, retornem defaults (el dispatch anirà per
|
||||||
// PostFX passthrough, però sent nets per si algú consulta aquests params).
|
// PostFX passthrough, però sent nets per si algú consulta aquests params).
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "core/audio/audio.hpp"
|
#include "core/audio/audio.hpp"
|
||||||
|
#include "core/rendering/render_info.hpp"
|
||||||
#include "core/rendering/screen.hpp"
|
#include "core/rendering/screen.hpp"
|
||||||
#include "core/rendering/shader_backend.hpp"
|
#include "core/rendering/shader_backend.hpp"
|
||||||
#include "utils/defaults.hpp"
|
#include "utils/defaults.hpp"
|
||||||
@@ -121,6 +122,9 @@ namespace Options {
|
|||||||
[[nodiscard]] auto buildPostFXParams() -> Rendering::PostFXParams;
|
[[nodiscard]] auto buildPostFXParams() -> Rendering::PostFXParams;
|
||||||
[[nodiscard]] auto buildCrtPiParams() -> Rendering::CrtPiParams;
|
[[nodiscard]] auto buildCrtPiParams() -> Rendering::CrtPiParams;
|
||||||
[[nodiscard]] auto buildActiveShader() -> Rendering::ShaderType;
|
[[nodiscard]] auto buildActiveShader() -> Rendering::ShaderType;
|
||||||
|
// Els colors de text/ombra els decideix la UI del joc (no Options), per
|
||||||
|
// això es passen com a paràmetres.
|
||||||
|
[[nodiscard]] auto buildRenderInfoFrame(Uint8 text_color, Uint8 shadow_color) -> RenderInfo::Frame;
|
||||||
// `::Audio` és la classe global d'àudio (no `Options::Audio`, que és la
|
// `::Audio` és la classe global d'àudio (no `Options::Audio`, que és la
|
||||||
// struct serialitzable). Retornem la seua Config per passar-la a init().
|
// struct serialitzable). Retornem la seua Config per passar-la a init().
|
||||||
[[nodiscard]] auto buildAudioConfig() -> ::Audio::Config;
|
[[nodiscard]] auto buildAudioConfig() -> ::Audio::Config;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "core/resources/resource_cache.hpp"
|
#include "core/resources/resource_cache.hpp"
|
||||||
#include "game/entities/player.hpp"
|
#include "game/entities/player.hpp"
|
||||||
#include "game/map/map.hpp"
|
#include "game/map/map.hpp"
|
||||||
|
#include "game/options.hpp"
|
||||||
#include "game/ui/ui_palette.hpp"
|
#include "game/ui/ui_palette.hpp"
|
||||||
#include "utils/defaults.hpp"
|
#include "utils/defaults.hpp"
|
||||||
#include "utils/defines.hpp"
|
#include "utils/defines.hpp"
|
||||||
@@ -60,7 +61,7 @@ void GameScene::update(int delta_ms) {
|
|||||||
|
|
||||||
const float DT = static_cast<float>(delta_ms) / 1000.0F;
|
const float DT = static_cast<float>(delta_ms) / 1000.0F;
|
||||||
for (auto& player : players_) { player->update(DT); }
|
for (auto& player : players_) { player->update(DT); }
|
||||||
RenderInfo::get().update(delta_ms);
|
RenderInfo::get().update(delta_ms, Options::buildRenderInfoFrame(UiColor::RENDER_INFO_TEXT, UiColor::RENDER_INFO_SHADOW));
|
||||||
Notifier::get().update(delta_ms);
|
Notifier::get().update(delta_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user