mes comandos per a Console
This commit is contained in:
@@ -529,6 +529,11 @@ void Screen::setDownscaleAlgo(int algo) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto Screen::getSsTextureSize() const -> std::pair<int, int> {
|
||||||
|
if (!shader_backend_) { return {0, 0}; }
|
||||||
|
return shader_backend_->getSsTextureSize();
|
||||||
|
}
|
||||||
|
|
||||||
// Activa/desactiva el supersampling global (Ctrl+F4)
|
// Activa/desactiva el supersampling global (Ctrl+F4)
|
||||||
void Screen::toggleSupersampling() {
|
void Screen::toggleSupersampling() {
|
||||||
Options::video.supersampling = !Options::video.supersampling;
|
Options::video.supersampling = !Options::video.supersampling;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <cstddef> // Para size_t
|
#include <cstddef> // Para size_t
|
||||||
#include <memory> // Para shared_ptr, __shared_ptr_access
|
#include <memory> // Para shared_ptr, __shared_ptr_access
|
||||||
#include <string> // Para string
|
#include <string> // Para string
|
||||||
|
#include <utility> // Para std::pair
|
||||||
#include <vector> // Para vector
|
#include <vector> // Para vector
|
||||||
|
|
||||||
#include "utils/utils.hpp" // Para Color
|
#include "utils/utils.hpp" // Para Color
|
||||||
@@ -77,6 +78,7 @@ class Screen {
|
|||||||
[[nodiscard]] auto getGPUDriver() const -> const std::string& { return gpu_driver_; }
|
[[nodiscard]] auto getGPUDriver() const -> const std::string& { return gpu_driver_; }
|
||||||
[[nodiscard]] auto getLastFPS() const -> int { return fps_.last_value; }
|
[[nodiscard]] auto getLastFPS() const -> int { return fps_.last_value; }
|
||||||
[[nodiscard]] auto getZoomFactor() const -> float { return zoom_factor_; }
|
[[nodiscard]] auto getZoomFactor() const -> float { return zoom_factor_; }
|
||||||
|
[[nodiscard]] auto getSsTextureSize() const -> std::pair<int, int>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Estructuras
|
// Estructuras
|
||||||
|
|||||||
@@ -924,6 +924,11 @@ namespace Rendering {
|
|||||||
downscale_algo_ = std::max(0, std::min(algo, 2));
|
downscale_algo_ = std::max(0, std::min(algo, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto SDL3GPUShader::getSsTextureSize() const -> std::pair<int, int> {
|
||||||
|
if (ss_factor_ <= 1) { return {0, 0}; }
|
||||||
|
return {game_width_ * ss_factor_, game_height_ * ss_factor_};
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// reinitTexturesAndBuffer — recrea scene_texture_, scaled_texture_ y
|
// reinitTexturesAndBuffer — recrea scene_texture_, scaled_texture_ y
|
||||||
// upload_buffer_ con el factor oversample_ actual. No toca pipelines ni samplers.
|
// upload_buffer_ con el factor oversample_ actual. No toca pipelines ni samplers.
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ namespace Rendering {
|
|||||||
// Selecciona algoritmo de downscale: 0=bilinear legacy, 1=Lanczos2, 2=Lanczos3
|
// Selecciona algoritmo de downscale: 0=bilinear legacy, 1=Lanczos2, 2=Lanczos3
|
||||||
void setDownscaleAlgo(int algo) override;
|
void setDownscaleAlgo(int algo) override;
|
||||||
|
|
||||||
|
// Devuelve las dimensiones de la textura de supersampling (0,0 si SS desactivado)
|
||||||
|
[[nodiscard]] auto getSsTextureSize() const -> std::pair<int, int> override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static auto createShaderMSL(SDL_GPUDevice* device,
|
static auto createShaderMSL(SDL_GPUDevice* device,
|
||||||
const char* msl_source,
|
const char* msl_source,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace Rendering {
|
namespace Rendering {
|
||||||
|
|
||||||
@@ -105,6 +106,12 @@ namespace Rendering {
|
|||||||
virtual void setDownscaleAlgo(int /*algo*/) {}
|
virtual void setDownscaleAlgo(int /*algo*/) {}
|
||||||
[[nodiscard]] virtual auto getDownscaleAlgo() const -> int { return 0; }
|
[[nodiscard]] virtual auto getDownscaleAlgo() const -> int { return 0; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Devuelve las dimensiones de la textura de supersampling.
|
||||||
|
* @return Par (ancho, alto) en píxeles; (0, 0) si SS está desactivado.
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual auto getSsTextureSize() const -> std::pair<int, int> { return {0, 0}; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Verifica si el backend está usando aceleración por hardware
|
* @brief Verifica si el backend está usando aceleración por hardware
|
||||||
* @return true si usa aceleración (OpenGL/Metal/Vulkan)
|
* @return true si usa aceleración (OpenGL/Metal/Vulkan)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ static auto parseTokens(const std::string& input) -> std::vector<std::string> {
|
|||||||
// Texto de ayuda común para HELP y ?
|
// Texto de ayuda común para HELP y ?
|
||||||
static void printHelp() {
|
static void printHelp() {
|
||||||
SDL_Log("=== JDD CONSOLE COMMANDS ===");
|
SDL_Log("=== JDD CONSOLE COMMANDS ===");
|
||||||
SDL_Log(" SS [ON|OFF] Supersampling (Ctrl+F4)");
|
SDL_Log(" SS [ON|OFF|SIZE] Supersampling (Ctrl+F4)");
|
||||||
SDL_Log(" POSTFX [ON|OFF|NEXT] Post-FX / next preset (F4/Shift+F4)");
|
SDL_Log(" POSTFX [ON|OFF|NEXT] Post-FX / next preset (F4/Shift+F4)");
|
||||||
SDL_Log(" BORDER [ON|OFF] Decorative border (B)");
|
SDL_Log(" BORDER [ON|OFF] Decorative border (B)");
|
||||||
SDL_Log(" FULLSCREEN [ON|OFF] Fullscreen mode (F3)");
|
SDL_Log(" FULLSCREEN [ON|OFF] Fullscreen mode (F3)");
|
||||||
@@ -107,8 +107,30 @@ static void printHelp() {
|
|||||||
|
|
||||||
// Tabla de comandos disponibles
|
// Tabla de comandos disponibles
|
||||||
static const std::vector<ConsoleCommand> COMMANDS = {
|
static const std::vector<ConsoleCommand> COMMANDS = {
|
||||||
// SS [ON|OFF] — Supersampling (Ctrl+F4)
|
// SS [ON|OFF|SIZE] — Supersampling (Ctrl+F4)
|
||||||
{.keyword = "SS", .execute = BOOL_TOGGLE_CMD("Supersampling", Options::video.supersampling, Screen::get()->toggleSupersampling())},
|
{.keyword = "SS", .execute = [](const std::vector<std::string>& args) -> std::string {
|
||||||
|
if (!args.empty() && args[0] == "SIZE") {
|
||||||
|
if (!Options::video.supersampling) { return "Supersampling OFF"; }
|
||||||
|
const auto [w, h] = Screen::get()->getSsTextureSize();
|
||||||
|
if (w == 0) { return "SS texture: not active"; }
|
||||||
|
return "SS texture: " + std::to_string(w) + "x" + std::to_string(h);
|
||||||
|
}
|
||||||
|
if (args.empty()) {
|
||||||
|
Screen::get()->toggleSupersampling();
|
||||||
|
return std::string("Supersampling ") + (Options::video.supersampling ? "ON" : "OFF");
|
||||||
|
}
|
||||||
|
if (args[0] == "ON") {
|
||||||
|
if (Options::video.supersampling) { return "Supersampling already ON"; }
|
||||||
|
Screen::get()->toggleSupersampling();
|
||||||
|
return "Supersampling ON";
|
||||||
|
}
|
||||||
|
if (args[0] == "OFF") {
|
||||||
|
if (!Options::video.supersampling) { return "Supersampling already OFF"; }
|
||||||
|
Screen::get()->toggleSupersampling();
|
||||||
|
return "Supersampling OFF";
|
||||||
|
}
|
||||||
|
return "Usage: SS [ON|OFF|SIZE]";
|
||||||
|
}},
|
||||||
|
|
||||||
// POSTFX [ON|OFF|NEXT] — PostFX y presets (F4 / Shift+F4)
|
// POSTFX [ON|OFF|NEXT] — PostFX y presets (F4 / Shift+F4)
|
||||||
{.keyword = "POSTFX", .execute = [](const std::vector<std::string>& args) -> std::string {
|
{.keyword = "POSTFX", .execute = [](const std::vector<std::string>& args) -> std::string {
|
||||||
|
|||||||
Reference in New Issue
Block a user