feat(effects): heat-haze sinusoidal al fons del títol (configurable a ui.yaml)
This commit is contained in:
1 parent
9233bd8d75
commit
1fc3ab8e31
9 files changed
+150
-3
No files matched your search
@@ -56,6 +56,14 @@ TitleScene::TitleScene(std::shared_ptr<Text> display_font, std::shared_ptr<Text>
|
||||
next_factory_(std::move(next_factory)),
|
||||
timer_ms_(UiConfig::get().titleDurationMs()) {
|
||||
std::cout << "[scene] " << SCENE_NAME << " start\n";
|
||||
const auto& hh = UiConfig::get().titleHeatHaze();
|
||||
if (hh.enabled) {
|
||||
heat_haze_.emplace(Effects::HeatHaze::Params{
|
||||
.amplitude_px = hh.amplitude_px,
|
||||
.wavelength_px = hh.wavelength_px,
|
||||
.speed_hz = hh.speed_hz,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
TitleScene::~TitleScene() = default;
|
||||
@@ -69,6 +77,7 @@ void TitleScene::update(int delta_ms) {
|
||||
|
||||
timer_ms_ -= delta_ms;
|
||||
blink_elapsed_ms_ += delta_ms;
|
||||
if (heat_haze_) { heat_haze_->tick(delta_ms); }
|
||||
|
||||
const bool SKIPPED = std::ranges::any_of(EventBuffer::events, [](const SDL_Event& ev) {
|
||||
return ev.type == SDL_EVENT_KEY_DOWN && !Placeholder::isReservedScancode(ev.key.scancode);
|
||||
@@ -87,10 +96,14 @@ void TitleScene::render() {
|
||||
const auto& palette = Resource::Cache::get().getPalette("ui");
|
||||
|
||||
// Fons: la imatge si està disponible (cobreix tot el canvas amb la
|
||||
// seua paleta nadiua); en cas contrari, color pla de la paleta UI
|
||||
// com a fallback defensiu.
|
||||
// seua paleta nadiua), opcionalment amb heat-haze; en cas contrari,
|
||||
// color pla de la paleta UI com a fallback defensiu.
|
||||
if (background_) {
|
||||
background_->render(0, 0);
|
||||
if (heat_haze_) {
|
||||
heat_haze_->render(*background_, 0, 0);
|
||||
} else {
|
||||
background_->render(0, 0);
|
||||
}
|
||||
} else {
|
||||
Screen::get().fillRect(0, 0, GameCanvas::WIDTH, GameCanvas::HEIGHT, palette[ui_config.titleBgColor()]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user