- canvi de tecles en el editor
- actualitzada la versió de console per lo dels colorins - clang format
This commit is contained in:
@@ -12,7 +12,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|||||||
|
|
||||||
1. **Habitaciones más grandes** — aprovechar el espacio del marcador (scoreboard) para ampliar el área jugable. Esto implica revisar la resolución de canvas, el layout de la HUD y el tamaño de los tilemaps.
|
1. **Habitaciones más grandes** — aprovechar el espacio del marcador (scoreboard) para ampliar el área jugable. Esto implica revisar la resolución de canvas, el layout de la HUD y el tamaño de los tilemaps.
|
||||||
2. ~~**Nueva física del jugador**~~ ✅ **HECHO** — Player reescrito con pipeline de 6 fases, colisiones tile-based, ~20 métodos eliminados.
|
2. ~~**Nueva física del jugador**~~ ✅ **HECHO** — Player reescrito con pipeline de 6 fases, colisiones tile-based, ~20 métodos eliminados.
|
||||||
3. ~~**Motor de colisiones por tiles**~~ ✅ **HECHO** — `TileCollider` con queries directas al grid. Collision tilemap editado desde el editor (tecla 7). Sistema antiguo de superficies preservado pero no usado. Pendiente: tiles kill (5) y conveyor (6).
|
3. ~~**Motor de colisiones por tiles**~~ ✅ **HECHO** — `TileCollider` con queries directas al grid. Collision tilemap editado desde el editor (tecla 8). Sistema antiguo de superficies preservado pero no usado. Pendiente: tiles kill (5) y conveyor (6).
|
||||||
4. ~~**Transición de pantalla animada**~~ ✅ **HECHO** — Scroll con easing `cubicInOut` (0.5s), ambas rooms visibles, enemigos activos, jugador puede moverse durante la transición.
|
4. ~~**Transición de pantalla animada**~~ ✅ **HECHO** — Scroll con easing `cubicInOut` (0.5s), ambas rooms visibles, enemigos activos, jugador puede moverse durante la transición.
|
||||||
5. **Paleta Amstrad CPC** — subir de la paleta actual (8-bit indexada limitada) a la paleta del Amstrad CPC (27 colores / más colores que la actual). Afecta a `PaletteManager` y a todos los assets de color.
|
5. **Paleta Amstrad CPC** — subir de la paleta actual (8-bit indexada limitada) a la paleta del Amstrad CPC (27 colores / más colores que la actual). Afecta a `PaletteManager` y a todos los assets de color.
|
||||||
|
|
||||||
|
|||||||
@@ -107,11 +107,11 @@ namespace Defaults::Notification {
|
|||||||
} // namespace Defaults::Notification
|
} // namespace Defaults::Notification
|
||||||
|
|
||||||
namespace Defaults::Console {
|
namespace Defaults::Console {
|
||||||
constexpr bool TRANSPARENT = false; // Por defecto sólida
|
constexpr bool TRANSPARENT = false; // Por defecto sólida
|
||||||
constexpr Uint8 BG_COLOR = 0; // Color de fondo (índice de paleta)
|
constexpr Uint8 BG_COLOR = 0; // Color de fondo (índice de paleta)
|
||||||
constexpr Uint8 MSG_COLOR = 8; // Color de los mensajes
|
constexpr Uint8 MSG_COLOR = 8; // Color de los mensajes
|
||||||
constexpr Uint8 PROMPT_COLOR = 9; // Color del prompt y del borde
|
constexpr Uint8 PROMPT_COLOR = 9; // Color del prompt y del borde
|
||||||
constexpr Uint8 COMMAND_COLOR = 9; // Color del texto que escribe el usuario
|
constexpr Uint8 COMMAND_COLOR = 9; // Color del texto que escribe el usuario
|
||||||
} // namespace Defaults::Console
|
} // namespace Defaults::Console
|
||||||
|
|
||||||
namespace Defaults::Localization {
|
namespace Defaults::Localization {
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath> // Para std::round
|
#include <cmath> // Para std::round
|
||||||
#include <cstdio> // Para std::remove (borrar fichero)
|
#include <cstdio> // Para std::remove (borrar fichero)
|
||||||
#include <filesystem> // Para directory_iterator (getAnimationCompletions)
|
#include <filesystem> // Para directory_iterator (getAnimationCompletions)
|
||||||
#include <fstream> // Para ifstream, ofstream
|
#include <fstream> // Para ifstream, ofstream
|
||||||
#include <iostream> // Para cout
|
#include <iostream> // Para cout
|
||||||
#include <set> // Para set
|
#include <set> // Para set
|
||||||
#include <system_error> // Para std::error_code
|
#include <system_error> // Para std::error_code
|
||||||
|
|
||||||
#include "core/input/mouse.hpp" // Para Mouse
|
#include "core/input/mouse.hpp" // Para Mouse
|
||||||
@@ -489,8 +489,8 @@ void MapEditor::handleEvent(const SDL_Event& event) { // NOLINT(readability-fun
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 7: alternar entre draw y collision
|
// 8: alternar entre draw y collision
|
||||||
if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_7 && static_cast<int>(event.key.repeat) == 0) {
|
if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_8 && static_cast<int>(event.key.repeat) == 0) {
|
||||||
setEditingCollision(!editing_collision_);
|
setEditingCollision(!editing_collision_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1520,11 +1520,20 @@ auto MapEditor::getSetCompletions() const -> std::vector<std::string> {
|
|||||||
auto MapEditor::getAnimationCompletions() const -> std::vector<std::string> {
|
auto MapEditor::getAnimationCompletions() const -> std::vector<std::string> {
|
||||||
const char* folder = nullptr;
|
const char* folder = nullptr;
|
||||||
switch (selection_.type) {
|
switch (selection_.type) {
|
||||||
case EntityType::ENEMY: folder = "data/enemies"; break;
|
case EntityType::ENEMY:
|
||||||
case EntityType::PLATFORM: folder = "data/platforms"; break;
|
folder = "data/enemies";
|
||||||
case EntityType::KEY: folder = "data/keys"; break;
|
break;
|
||||||
case EntityType::DOOR: folder = "data/doors"; break;
|
case EntityType::PLATFORM:
|
||||||
default: return {};
|
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::vector<std::string> result;
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
|
|||||||
@@ -226,10 +226,10 @@ class MapEditor {
|
|||||||
bool active_{false};
|
bool active_{false};
|
||||||
DragState drag_;
|
DragState drag_;
|
||||||
Selection selection_; // Entidad seleccionada (unificada: enemy, item o platform)
|
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)
|
EyedropperState eyedropper_; // Estado del eyedropper (clic derecho)
|
||||||
bool painting_{false}; // true mientras se está pintando con click izquierdo mantenido
|
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 editing_collision_{false}; // true = editando collision tilemap, false = editando draw tilemap
|
||||||
|
|
||||||
// Datos de la habitación
|
// Datos de la habitación
|
||||||
Room::Data room_data_;
|
Room::Data room_data_;
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ class MiniMap {
|
|||||||
|
|
||||||
// Tabla de color predominante para un tileset concreto
|
// Tabla de color predominante para un tileset concreto
|
||||||
struct TileColorTable {
|
struct TileColorTable {
|
||||||
std::vector<Uint8> colors; // tile_index → palette color
|
std::vector<Uint8> colors; // tile_index → palette color
|
||||||
int tileset_width{0}; // Ancho del tileset en tiles
|
int tileset_width{0}; // Ancho del tileset en tiles
|
||||||
Uint8 transparent{16}; // Color transparente del tileset
|
Uint8 transparent{16}; // Color transparente del tileset
|
||||||
};
|
};
|
||||||
|
|
||||||
auto getOrBuildTileColorTable(const std::string& tileset_name) -> const TileColorTable&;
|
auto getOrBuildTileColorTable(const std::string& tileset_name) -> const TileColorTable&;
|
||||||
|
|||||||
@@ -592,19 +592,29 @@ namespace Options {
|
|||||||
const auto& c = yaml["console"];
|
const auto& c = yaml["console"];
|
||||||
|
|
||||||
if (c.contains("transparent")) {
|
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")) {
|
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")) {
|
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")) {
|
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")) {
|
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
|
// CONSOLE
|
||||||
file << "# CONSOLE\n";
|
file << "# CONSOLE\n";
|
||||||
file << "console:\n";
|
file << "console:\n";
|
||||||
file << " transparent: " << (console.transparent ? "true" : "false") << " # true = sin fondo, false = solida\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 << " 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 << " 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 << " 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 << " command_color: " << console.command_color << " # indice de paleta del texto escrito por el usuario\n";
|
||||||
file << "\n";
|
file << "\n";
|
||||||
|
|
||||||
|
|||||||
@@ -140,11 +140,11 @@ namespace Options {
|
|||||||
|
|
||||||
// Estructura para las opciones visuales de la consola en pantalla
|
// Estructura para las opciones visuales de la consola en pantalla
|
||||||
struct Console {
|
struct Console {
|
||||||
bool transparent{Defaults::Console::TRANSPARENT}; // true = sin fondo, false = sólida
|
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 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 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 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
|
int command_color{Defaults::Console::COMMAND_COLOR}; // Índice de paleta del texto escrito por el usuario
|
||||||
};
|
};
|
||||||
|
|
||||||
// Estructura para un preset de PostFX
|
// Estructura para un preset de PostFX
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ void Game::handleEvents() {
|
|||||||
GameControl::enter_editor();
|
GameControl::enter_editor();
|
||||||
Notifier::get()->show({Locale::get()->get("game.editor_enabled")}); // NOLINT(readability-static-accessed-through-instance)
|
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());
|
MapEditor::get()->showGrid(!MapEditor::get()->isGridEnabled());
|
||||||
} else if (MapEditor::get()->isActive()) {
|
} else if (MapEditor::get()->isActive()) {
|
||||||
MapEditor::get()->handleEvent(event);
|
MapEditor::get()->handleEvent(event);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class Console {
|
|||||||
|
|
||||||
// Constantes de consola
|
// Constantes de consola
|
||||||
static constexpr std::string_view CONSOLE_NAME = "Projecte 2026 Console";
|
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_LINE_CHARS = 32;
|
||||||
static constexpr int MAX_HISTORY_SIZE = 20;
|
static constexpr int MAX_HISTORY_SIZE = 20;
|
||||||
static constexpr float CURSOR_ON_TIME = 0.5F;
|
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>]
|
// 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)
|
static auto cmdConsole(const std::vector<std::string>& args) -> std::string { // NOLINT(readability-function-cognitive-complexity)
|
||||||
if (args.empty()) {
|
if (args.empty()) {
|
||||||
return std::string("Console ") + (Options::console.transparent ? "transparent" : "solid")
|
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);
|
||||||
+ " 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") {
|
if (args[0] == "TRANSPARENT") {
|
||||||
@@ -1340,7 +1336,7 @@ auto CommandRegistry::generateConsoleHelp() const -> std::string { // NOLINT(re
|
|||||||
|
|
||||||
if (active_scope_ == "editor" && !editor_cmds.empty()) {
|
if (active_scope_ == "editor" && !editor_cmds.empty()) {
|
||||||
result += "Editor:\n" + editor_cmds + "\n";
|
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()) {
|
if (!debug_cmds.empty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user