afegit overlay de debug
This commit is contained in:
@@ -329,8 +329,6 @@ void Screen::surfaceToTexture() { // NOLINT(readability-convert-member-function
|
||||
|
||||
// Copia la textura al renderizador (o hace el present GPU)
|
||||
void Screen::textureToRenderer() {
|
||||
SDL_Texture* texture_to_render = Options::video.border.enabled ? border_texture_ : game_texture_;
|
||||
|
||||
if (shader_backend_ && shader_backend_->isHardwareAccelerated()) {
|
||||
// ---- SDL3 GPU path: convertir Surface → ARGB → upload → PostFX/pass-through → present ----
|
||||
if (Options::video.border.enabled) {
|
||||
@@ -363,6 +361,7 @@ void Screen::textureToRenderer() {
|
||||
shader_backend_->render();
|
||||
} else {
|
||||
// ---- SDL_Renderer path (fallback / no-shader) ----
|
||||
SDL_Texture* texture_to_render = Options::video.border.enabled ? border_texture_ : game_texture_;
|
||||
SDL_SetRenderTarget(renderer_, nullptr);
|
||||
SDL_SetRenderDrawColor(renderer_, 0x00, 0x00, 0x00, 0xFF);
|
||||
SDL_RenderClear(renderer_);
|
||||
@@ -393,18 +392,48 @@ auto Screen::findPalette(const std::string& name) -> size_t { // NOLINT(readabi
|
||||
|
||||
// Muestra información por pantalla
|
||||
void Screen::renderInfo() const {
|
||||
if (show_fps_ && (Resource::Cache::get() != nullptr)) {
|
||||
auto text = Resource::Cache::get()->getText("smb2");
|
||||
auto color = static_cast<Uint8>(PaletteColor::YELLOW);
|
||||
auto shadow = static_cast<Uint8>(PaletteColor::BLACK);
|
||||
|
||||
// FPS con sombra
|
||||
const std::string FPS_TEXT = std::to_string(fps_.last_value) + " FPS";
|
||||
const int FPS_X = Options::game.width - text->length(FPS_TEXT) - 1;
|
||||
|
||||
text->writeColored(FPS_X + 1, 1, FPS_TEXT, shadow);
|
||||
text->writeColored(FPS_X, 0, FPS_TEXT, color);
|
||||
if (!show_fps_ || text_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto white = static_cast<Uint8>(PaletteColor::WHITE);
|
||||
//const auto black = static_cast<Uint8>(PaletteColor::BLACK);
|
||||
const int LINE_HEIGHT = text_->getCharacterSize() - 3;
|
||||
const int X = 0;
|
||||
int y = 0;
|
||||
|
||||
// FPS
|
||||
const std::string FPS_TEXT = std::to_string(fps_.last_value) + " fps";
|
||||
//text_->writeColored(X + 1, y + 1, FPS_TEXT, black);
|
||||
text_->writeColored(X, y, FPS_TEXT, white);
|
||||
y += LINE_HEIGHT;
|
||||
|
||||
// Zoom de la ventana
|
||||
const std::string ZOOM_TEXT = "zoom x" + std::to_string(Options::window.zoom);
|
||||
//text_->writeColored(X + 1, y + 1, ZOOM_TEXT, black);
|
||||
text_->writeColored(X, y, ZOOM_TEXT, white);
|
||||
y += LINE_HEIGHT;
|
||||
|
||||
// PostFX enabled
|
||||
const std::string POSTFX_TEXT = std::string("postfx ") + (Options::video.postfx ? "on" : "off");
|
||||
//text_->writeColored(X + 1, y + 1, POSTFX_TEXT, black);
|
||||
text_->writeColored(X, y, POSTFX_TEXT, white);
|
||||
y += LINE_HEIGHT;
|
||||
|
||||
// PostFX preset
|
||||
std::string preset_name = "-";
|
||||
if (!Options::postfx_presets.empty()) {
|
||||
preset_name = Options::postfx_presets[static_cast<size_t>(Options::current_postfx_preset)].name;
|
||||
}
|
||||
const std::string PRESET_TEXT = "preset " + preset_name;
|
||||
//text_->writeColored(X + 1, y + 1, PRESET_TEXT, black);
|
||||
text_->writeColored(X, y, PRESET_TEXT, white);
|
||||
y += LINE_HEIGHT;
|
||||
|
||||
// Supersampling enabled
|
||||
const std::string SS_TEXT = std::string("ss ") + (Options::video.supersampling ? "on" : "off");
|
||||
//text_->writeColored(X + 1, y + 1, SS_TEXT, black);
|
||||
text_->writeColored(X, y, SS_TEXT, white);
|
||||
}
|
||||
|
||||
// Limpia la game_surface_
|
||||
@@ -612,6 +641,7 @@ auto Screen::initSDLVideo() -> bool {
|
||||
void Screen::createText() { // NOLINT(readability-convert-member-functions-to-static)
|
||||
// Carga la surface de la fuente directamente del archivo
|
||||
auto surface = std::make_shared<Surface>(Resource::List::get()->get("aseprite.gif"));
|
||||
//surface->setTransparentColor(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
|
||||
// Crea el objeto de texto (el constructor de Text carga el archivo text_file internamente)
|
||||
text_ = std::make_shared<Text>(surface, Resource::List::get()->get("aseprite.fnt"));
|
||||
|
||||
Reference in New Issue
Block a user