- canvi de tecles en el editor
- actualitzada la versió de console per lo dels colorins - clang format
This commit is contained in:
@@ -107,11 +107,11 @@ namespace Defaults::Notification {
|
||||
} // namespace Defaults::Notification
|
||||
|
||||
namespace Defaults::Console {
|
||||
constexpr bool TRANSPARENT = false; // Por defecto sólida
|
||||
constexpr Uint8 BG_COLOR = 0; // Color de fondo (índice de paleta)
|
||||
constexpr Uint8 MSG_COLOR = 8; // Color de los mensajes
|
||||
constexpr Uint8 PROMPT_COLOR = 9; // Color del prompt y del borde
|
||||
constexpr Uint8 COMMAND_COLOR = 9; // Color del texto que escribe el usuario
|
||||
constexpr bool TRANSPARENT = false; // Por defecto sólida
|
||||
constexpr Uint8 BG_COLOR = 0; // Color de fondo (índice de paleta)
|
||||
constexpr Uint8 MSG_COLOR = 8; // Color de los mensajes
|
||||
constexpr Uint8 PROMPT_COLOR = 9; // Color del prompt y del borde
|
||||
constexpr Uint8 COMMAND_COLOR = 9; // Color del texto que escribe el usuario
|
||||
} // namespace Defaults::Console
|
||||
|
||||
namespace Defaults::Localization {
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath> // Para std::round
|
||||
#include <cstdio> // Para std::remove (borrar fichero)
|
||||
#include <filesystem> // Para directory_iterator (getAnimationCompletions)
|
||||
#include <fstream> // Para ifstream, ofstream
|
||||
#include <iostream> // Para cout
|
||||
#include <set> // Para set
|
||||
#include <cmath> // Para std::round
|
||||
#include <cstdio> // Para std::remove (borrar fichero)
|
||||
#include <filesystem> // Para directory_iterator (getAnimationCompletions)
|
||||
#include <fstream> // Para ifstream, ofstream
|
||||
#include <iostream> // Para cout
|
||||
#include <set> // Para set
|
||||
#include <system_error> // Para std::error_code
|
||||
|
||||
#include "core/input/mouse.hpp" // Para Mouse
|
||||
@@ -489,8 +489,8 @@ void MapEditor::handleEvent(const SDL_Event& event) { // NOLINT(readability-fun
|
||||
return;
|
||||
}
|
||||
|
||||
// 7: alternar entre draw y collision
|
||||
if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_7 && static_cast<int>(event.key.repeat) == 0) {
|
||||
// 8: alternar entre draw y collision
|
||||
if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_8 && static_cast<int>(event.key.repeat) == 0) {
|
||||
setEditingCollision(!editing_collision_);
|
||||
return;
|
||||
}
|
||||
@@ -1520,11 +1520,20 @@ auto MapEditor::getSetCompletions() const -> std::vector<std::string> {
|
||||
auto MapEditor::getAnimationCompletions() const -> std::vector<std::string> {
|
||||
const char* folder = nullptr;
|
||||
switch (selection_.type) {
|
||||
case EntityType::ENEMY: folder = "data/enemies"; break;
|
||||
case EntityType::PLATFORM: folder = "data/platforms"; break;
|
||||
case EntityType::KEY: folder = "data/keys"; break;
|
||||
case EntityType::DOOR: folder = "data/doors"; break;
|
||||
default: return {};
|
||||
case EntityType::ENEMY:
|
||||
folder = "data/enemies";
|
||||
break;
|
||||
case EntityType::PLATFORM:
|
||||
folder = "data/platforms";
|
||||
break;
|
||||
case EntityType::KEY:
|
||||
folder = "data/keys";
|
||||
break;
|
||||
case EntityType::DOOR:
|
||||
folder = "data/doors";
|
||||
break;
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
std::vector<std::string> result;
|
||||
std::error_code ec;
|
||||
|
||||
@@ -226,10 +226,10 @@ class MapEditor {
|
||||
bool active_{false};
|
||||
DragState drag_;
|
||||
Selection selection_; // Entidad seleccionada (unificada: enemy, item o platform)
|
||||
BrushPattern brush_; // Brush activo (vacío = sin brush)
|
||||
BrushPattern brush_; // Brush activo (vacío = sin brush)
|
||||
EyedropperState eyedropper_; // Estado del eyedropper (clic derecho)
|
||||
bool painting_{false}; // true mientras se está pintando con click izquierdo mantenido
|
||||
bool editing_collision_{false}; // true = editando collision tilemap, false = editando draw tilemap
|
||||
bool painting_{false}; // true mientras se está pintando con click izquierdo mantenido
|
||||
bool editing_collision_{false}; // true = editando collision tilemap, false = editando draw tilemap
|
||||
|
||||
// Datos de la habitación
|
||||
Room::Data room_data_;
|
||||
|
||||
@@ -51,9 +51,9 @@ class MiniMap {
|
||||
|
||||
// Tabla de color predominante para un tileset concreto
|
||||
struct TileColorTable {
|
||||
std::vector<Uint8> colors; // tile_index → palette color
|
||||
int tileset_width{0}; // Ancho del tileset en tiles
|
||||
Uint8 transparent{16}; // Color transparente del tileset
|
||||
std::vector<Uint8> colors; // tile_index → palette color
|
||||
int tileset_width{0}; // Ancho del tileset en tiles
|
||||
Uint8 transparent{16}; // Color transparente del tileset
|
||||
};
|
||||
|
||||
auto getOrBuildTileColorTable(const std::string& tileset_name) -> const TileColorTable&;
|
||||
|
||||
@@ -592,19 +592,29 @@ namespace Options {
|
||||
const auto& c = yaml["console"];
|
||||
|
||||
if (c.contains("transparent")) {
|
||||
try { console.transparent = c["transparent"].get_value<bool>(); } catch (...) {}
|
||||
try {
|
||||
console.transparent = c["transparent"].get_value<bool>();
|
||||
} catch (...) {}
|
||||
}
|
||||
if (c.contains("bg_color")) {
|
||||
try { console.bg_color = std::clamp(c["bg_color"].get_value<int>(), 0, 255); } catch (...) {}
|
||||
try {
|
||||
console.bg_color = std::clamp(c["bg_color"].get_value<int>(), 0, 255);
|
||||
} catch (...) {}
|
||||
}
|
||||
if (c.contains("msg_color")) {
|
||||
try { console.msg_color = std::clamp(c["msg_color"].get_value<int>(), 0, 255); } catch (...) {}
|
||||
try {
|
||||
console.msg_color = std::clamp(c["msg_color"].get_value<int>(), 0, 255);
|
||||
} catch (...) {}
|
||||
}
|
||||
if (c.contains("prompt_color")) {
|
||||
try { console.prompt_color = std::clamp(c["prompt_color"].get_value<int>(), 0, 255); } catch (...) {}
|
||||
try {
|
||||
console.prompt_color = std::clamp(c["prompt_color"].get_value<int>(), 0, 255);
|
||||
} catch (...) {}
|
||||
}
|
||||
if (c.contains("command_color")) {
|
||||
try { console.command_color = std::clamp(c["command_color"].get_value<int>(), 0, 255); } catch (...) {}
|
||||
try {
|
||||
console.command_color = std::clamp(c["command_color"].get_value<int>(), 0, 255);
|
||||
} catch (...) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,10 +760,10 @@ namespace Options {
|
||||
// CONSOLE
|
||||
file << "# CONSOLE\n";
|
||||
file << "console:\n";
|
||||
file << " transparent: " << (console.transparent ? "true" : "false") << " # true = sin fondo, false = solida\n";
|
||||
file << " bg_color: " << console.bg_color << " # indice de paleta del fondo (solo si transparent: false)\n";
|
||||
file << " msg_color: " << console.msg_color << " # indice de paleta de los mensajes\n";
|
||||
file << " prompt_color: " << console.prompt_color << " # indice de paleta del prompt y del borde\n";
|
||||
file << " transparent: " << (console.transparent ? "true" : "false") << " # true = sin fondo, false = solida\n";
|
||||
file << " bg_color: " << console.bg_color << " # indice de paleta del fondo (solo si transparent: false)\n";
|
||||
file << " msg_color: " << console.msg_color << " # indice de paleta de los mensajes\n";
|
||||
file << " prompt_color: " << console.prompt_color << " # indice de paleta del prompt y del borde\n";
|
||||
file << " command_color: " << console.command_color << " # indice de paleta del texto escrito por el usuario\n";
|
||||
file << "\n";
|
||||
|
||||
|
||||
@@ -140,11 +140,11 @@ namespace Options {
|
||||
|
||||
// Estructura para las opciones visuales de la consola en pantalla
|
||||
struct Console {
|
||||
bool transparent{Defaults::Console::TRANSPARENT}; // true = sin fondo, false = sólida
|
||||
int bg_color{Defaults::Console::BG_COLOR}; // Índice de paleta del fondo (sólo si !transparent)
|
||||
int msg_color{Defaults::Console::MSG_COLOR}; // Índice de paleta de las líneas de mensaje
|
||||
int prompt_color{Defaults::Console::PROMPT_COLOR}; // Índice de paleta del prompt y del borde
|
||||
int command_color{Defaults::Console::COMMAND_COLOR};// Índice de paleta del texto escrito por el usuario
|
||||
bool transparent{Defaults::Console::TRANSPARENT}; // true = sin fondo, false = sólida
|
||||
int bg_color{Defaults::Console::BG_COLOR}; // Índice de paleta del fondo (sólo si !transparent)
|
||||
int msg_color{Defaults::Console::MSG_COLOR}; // Índice de paleta de las líneas de mensaje
|
||||
int prompt_color{Defaults::Console::PROMPT_COLOR}; // Índice de paleta del prompt y del borde
|
||||
int command_color{Defaults::Console::COMMAND_COLOR}; // Índice de paleta del texto escrito por el usuario
|
||||
};
|
||||
|
||||
// Estructura para un preset de PostFX
|
||||
|
||||
@@ -215,7 +215,7 @@ void Game::handleEvents() {
|
||||
GameControl::enter_editor();
|
||||
Notifier::get()->show({Locale::get()->get("game.editor_enabled")}); // NOLINT(readability-static-accessed-through-instance)
|
||||
}
|
||||
} else if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_8 && static_cast<int>(event.key.repeat) == 0 && MapEditor::get()->isActive()) {
|
||||
} else if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_G && static_cast<int>(event.key.repeat) == 0 && MapEditor::get()->isActive()) {
|
||||
MapEditor::get()->showGrid(!MapEditor::get()->isGridEnabled());
|
||||
} else if (MapEditor::get()->isActive()) {
|
||||
MapEditor::get()->handleEvent(event);
|
||||
|
||||
@@ -58,7 +58,7 @@ class Console {
|
||||
|
||||
// Constantes de consola
|
||||
static constexpr std::string_view CONSOLE_NAME = "Projecte 2026 Console";
|
||||
static constexpr std::string_view CONSOLE_VERSION = "v2.2";
|
||||
static constexpr std::string_view CONSOLE_VERSION = "v2.3";
|
||||
static constexpr int MAX_LINE_CHARS = 32;
|
||||
static constexpr int MAX_HISTORY_SIZE = 20;
|
||||
static constexpr float CURSOR_ON_TIME = 0.5F;
|
||||
|
||||
@@ -954,11 +954,7 @@ static auto cmdSize(const std::vector<std::string>& /*unused*/) -> std::string {
|
||||
// CONSOLE [TRANSPARENT [ON|OFF]|BG|MSG|PROMPT|COMMAND <0-255>]
|
||||
static auto cmdConsole(const std::vector<std::string>& args) -> std::string { // NOLINT(readability-function-cognitive-complexity)
|
||||
if (args.empty()) {
|
||||
return std::string("Console ") + (Options::console.transparent ? "transparent" : "solid")
|
||||
+ " bg:" + std::to_string(Options::console.bg_color)
|
||||
+ " msg:" + std::to_string(Options::console.msg_color)
|
||||
+ " prompt:" + std::to_string(Options::console.prompt_color)
|
||||
+ " cmd:" + std::to_string(Options::console.command_color);
|
||||
return std::string("Console ") + (Options::console.transparent ? "transparent" : "solid") + " bg:" + std::to_string(Options::console.bg_color) + " msg:" + std::to_string(Options::console.msg_color) + " prompt:" + std::to_string(Options::console.prompt_color) + " cmd:" + std::to_string(Options::console.command_color);
|
||||
}
|
||||
|
||||
if (args[0] == "TRANSPARENT") {
|
||||
@@ -1340,7 +1336,7 @@ auto CommandRegistry::generateConsoleHelp() const -> std::string { // NOLINT(re
|
||||
|
||||
if (active_scope_ == "editor" && !editor_cmds.empty()) {
|
||||
result += "Editor:\n" + editor_cmds + "\n";
|
||||
result += "keys: 9=editor 8=grid e=eraser m=map\n";
|
||||
result += "keys: 9=editor g=grid 8=collision e=eraser m=map\n";
|
||||
}
|
||||
|
||||
if (!debug_cmds.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user