GlobalInputs F1-F12 + Escape, Screen sense destruir finestra, escalat al GPU, presets i fons canvas (v0.11.0)
This commit is contained in:
1 parent
837eb73398
commit
297dc85e47
23 files changed
+653
-34
No files matched your search
+99
-17
@@ -125,11 +125,10 @@ namespace {
|
||||
parseSound(node);
|
||||
}
|
||||
|
||||
// Presets per defecte de PostFX, usats quan el fitxer postfx.yaml no existeix.
|
||||
// Presets per defecte de PostFX, portats directament de projecte_2026.
|
||||
auto defaultPostFXPresets() -> std::vector<Options::PostFXPreset> {
|
||||
return {
|
||||
{.name = "off"}, // passthrough (tot a 0)
|
||||
{.name = "crt",
|
||||
{.name = "CRT",
|
||||
.vignette = 0.6F,
|
||||
.scanlines = 0.7F,
|
||||
.chroma = 0.15F,
|
||||
@@ -138,15 +137,51 @@ namespace {
|
||||
.curvature = 0.0F,
|
||||
.bleeding = 0.0F,
|
||||
.flicker = 0.0F},
|
||||
{.name = "ntsc",
|
||||
{.name = "NTSC",
|
||||
.vignette = 0.4F,
|
||||
.scanlines = 0.5F,
|
||||
.chroma = 0.25F,
|
||||
.mask = 0.3F,
|
||||
.gamma = 0.6F,
|
||||
.chroma = 0.2F,
|
||||
.mask = 0.4F,
|
||||
.gamma = 0.5F,
|
||||
.curvature = 0.0F,
|
||||
.bleeding = 0.6F,
|
||||
.flicker = 0.0F},
|
||||
{.name = "CURVED",
|
||||
.vignette = 0.5F,
|
||||
.scanlines = 0.6F,
|
||||
.chroma = 0.1F,
|
||||
.mask = 0.5F,
|
||||
.gamma = 0.7F,
|
||||
.curvature = 0.8F,
|
||||
.bleeding = 0.0F,
|
||||
.flicker = 0.0F},
|
||||
{.name = "SCANLINES",
|
||||
.vignette = 0.0F,
|
||||
.scanlines = 0.8F,
|
||||
.chroma = 0.0F,
|
||||
.mask = 0.0F,
|
||||
.gamma = 0.0F,
|
||||
.curvature = 0.0F,
|
||||
.bleeding = 0.0F,
|
||||
.flicker = 0.0F},
|
||||
{.name = "SUBTLE",
|
||||
.vignette = 0.3F,
|
||||
.scanlines = 0.4F,
|
||||
.chroma = 0.05F,
|
||||
.mask = 0.0F,
|
||||
.gamma = 0.3F,
|
||||
.curvature = 0.0F,
|
||||
.bleeding = 0.0F,
|
||||
.flicker = 0.0F},
|
||||
{.name = "CRT LIVE",
|
||||
.vignette = 0.5F,
|
||||
.scanlines = 0.6F,
|
||||
.chroma = 0.3F,
|
||||
.mask = 0.3F,
|
||||
.gamma = 0.4F,
|
||||
.curvature = 0.3F,
|
||||
.bleeding = 0.4F,
|
||||
.flicker = 0.1F},
|
||||
.flicker = 0.8F},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -174,22 +209,69 @@ namespace {
|
||||
out << " flicker: " << preset.flicker << "\n";
|
||||
}
|
||||
|
||||
// Presets per defecte de CrtPi (tuning bàsic del shader original CRT-Pi).
|
||||
// Presets per defecte del shader CRT-Pi, portats de projecte_2026.
|
||||
auto defaultCrtPiPresets() -> std::vector<Options::CrtPiPreset> {
|
||||
return {
|
||||
{.name = "default"},
|
||||
{.name = "sharper",
|
||||
.scanline_weight = 8.0F,
|
||||
.scanline_gap_brightness = 0.10F,
|
||||
.bloom_factor = 3.0F,
|
||||
.enable_sharper = true},
|
||||
{.name = "curved",
|
||||
{.name = "DEFAULT",
|
||||
.scanline_weight = 6.0F,
|
||||
.scanline_gap_brightness = 0.12F,
|
||||
.bloom_factor = 3.5F,
|
||||
.input_gamma = 2.4F,
|
||||
.output_gamma = 2.2F,
|
||||
.mask_brightness = 0.80F,
|
||||
.curvature_x = 0.05F,
|
||||
.curvature_y = 0.10F,
|
||||
.enable_curvature = true},
|
||||
.mask_type = 2,
|
||||
.enable_scanlines = true,
|
||||
.enable_multisample = true,
|
||||
.enable_gamma = true,
|
||||
.enable_curvature = false,
|
||||
.enable_sharper = false},
|
||||
{.name = "CURVED",
|
||||
.scanline_weight = 6.0F,
|
||||
.scanline_gap_brightness = 0.12F,
|
||||
.bloom_factor = 3.5F,
|
||||
.input_gamma = 2.4F,
|
||||
.output_gamma = 2.2F,
|
||||
.mask_brightness = 0.80F,
|
||||
.curvature_x = 0.05F,
|
||||
.curvature_y = 0.10F,
|
||||
.mask_type = 2,
|
||||
.enable_scanlines = true,
|
||||
.enable_multisample = true,
|
||||
.enable_gamma = true,
|
||||
.enable_curvature = true,
|
||||
.enable_sharper = false},
|
||||
{.name = "SHARP",
|
||||
.scanline_weight = 6.0F,
|
||||
.scanline_gap_brightness = 0.12F,
|
||||
.bloom_factor = 3.5F,
|
||||
.input_gamma = 2.4F,
|
||||
.output_gamma = 2.2F,
|
||||
.mask_brightness = 0.80F,
|
||||
.curvature_x = 0.05F,
|
||||
.curvature_y = 0.10F,
|
||||
.mask_type = 2,
|
||||
.enable_scanlines = true,
|
||||
.enable_multisample = false,
|
||||
.enable_gamma = true,
|
||||
.enable_curvature = false,
|
||||
.enable_sharper = true},
|
||||
{.name = "MINIMAL",
|
||||
.scanline_weight = 8.0F,
|
||||
.scanline_gap_brightness = 0.05F,
|
||||
.bloom_factor = 2.0F,
|
||||
.input_gamma = 2.4F,
|
||||
.output_gamma = 2.2F,
|
||||
.mask_brightness = 1.00F,
|
||||
.curvature_x = 0.0F,
|
||||
.curvature_y = 0.0F,
|
||||
.mask_type = 0,
|
||||
.enable_scanlines = true,
|
||||
.enable_multisample = false,
|
||||
.enable_gamma = false,
|
||||
.enable_curvature = false,
|
||||
.enable_sharper = false},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include "core/locale/locale.hpp"
|
||||
#include "core/input/global_inputs.hpp"
|
||||
#include "core/rendering/notifier.hpp"
|
||||
#include "core/rendering/render_info.hpp"
|
||||
#include "core/rendering/screen.hpp"
|
||||
#include "core/resources/resource_cache.hpp"
|
||||
#include "core/system/event_buffer.hpp"
|
||||
#include "game/entities/player.hpp"
|
||||
#include "game/ui/ui_palette.hpp"
|
||||
#include "utils/defaults.hpp"
|
||||
#include "utils/defines.hpp"
|
||||
|
||||
@@ -33,13 +33,8 @@ GameScene::GameScene() {
|
||||
GameScene::~GameScene() = default;
|
||||
|
||||
void GameScene::update(int delta_ms) {
|
||||
for (const auto& event : EventBuffer::events) {
|
||||
if (event.type == SDL_EVENT_KEY_DOWN) {
|
||||
if (event.key.scancode == SDL_SCANCODE_ESCAPE) { wants_quit_ = true; }
|
||||
if (event.key.scancode == SDL_SCANCODE_F3) { RenderInfo::get().toggle(); }
|
||||
if (event.key.scancode == SDL_SCANCODE_F4) { Notifier::get().notify(Locale::get().text("notification.test")); }
|
||||
}
|
||||
}
|
||||
GlobalInputs::update(delta_ms);
|
||||
if (GlobalInputs::wantsQuit()) { wants_quit_ = true; }
|
||||
|
||||
const float DT = static_cast<float>(delta_ms) / 1000.0F;
|
||||
for (auto& player : players_) { player->update(DT); }
|
||||
@@ -48,7 +43,8 @@ void GameScene::update(int delta_ms) {
|
||||
}
|
||||
|
||||
void GameScene::render() {
|
||||
Screen::get().clear(0x00, 0x00, 0x00);
|
||||
const auto BG_ARGB = Resource::Cache::get().getPalette("ui")[UiColor::CANVAS_BG];
|
||||
Screen::get().fillRect(0, 0, GameCanvas::WIDTH, GameCanvas::HEIGHT, BG_ARGB);
|
||||
for (auto& player : players_) { player->render(); }
|
||||
Notifier::get().render();
|
||||
RenderInfo::get().render();
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
namespace UiColor {
|
||||
|
||||
// Color per al text de l'overlay de debug RenderInfo (F3).
|
||||
constexpr Uint8 RENDER_INFO_TEXT = 9;
|
||||
constexpr Uint8 RENDER_INFO_TEXT = 47;
|
||||
|
||||
// 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, ...).
|
||||
constexpr Uint8 CANVAS_BG = 65;
|
||||
|
||||
} // namespace UiColor
|
||||
Reference in new issue
Block a user