treballant en sistema de portes i claus

This commit is contained in:
2026-04-10 09:47:48 +02:00
parent 9aff4432df
commit 97c30bf9a1
37 changed files with 1236 additions and 110 deletions

View File

@@ -7,9 +7,9 @@
#include <memory> // Para shared_ptr, unique_ptr
#include <string> // Para string
#include "external/fkyaml_node.hpp" // Para fkyaml::node
#include "game/editor/mini_map.hpp" // Para MiniMap
#include "game/editor/tile_picker.hpp" // Para TilePicker
#include "external/fkyaml_node.hpp" // Para fkyaml::node
#include "game/editor/mini_map.hpp" // Para MiniMap
#include "game/editor/tile_picker.hpp" // Para TilePicker
#include "game/entities/enemy.hpp" // Para Enemy::Data
#include "game/entities/item.hpp" // Para Item::Data
#include "game/entities/moving_platform.hpp" // Para MovingPlatform::Data
@@ -21,13 +21,19 @@
class EditorStatusBar;
// Tipo de entidad editable en el editor
enum class EntityType { NONE, ENEMY, ITEM, PLATFORM };
enum class EntityType { NONE,
ENEMY,
ITEM,
PLATFORM };
// Seleccion unificada: una sola entidad seleccionada a la vez
struct Selection {
EntityType type{EntityType::NONE};
int index{-1};
void clear() { type = EntityType::NONE; index = -1; }
void clear() {
type = EntityType::NONE;
index = -1;
}
[[nodiscard]] auto isNone() const -> bool { return type == EntityType::NONE; }
[[nodiscard]] auto is(EntityType t) const -> bool { return type == t && index >= 0; }
};
@@ -140,7 +146,9 @@ class MapEditor {
static auto pointInRect(float px, float py, const SDL_FRect& rect) -> bool;
// Entity helpers: acceso abstracto a datos de entidad por tipo
struct BoundaryData { int x1, y1, x2, y2; };
struct BoundaryData {
int x1, y1, x2, y2;
};
auto entityCount(EntityType type) const -> int;
auto entityRect(EntityType type, int index) -> SDL_FRect;
static auto entityHasBoundaries(EntityType type) -> bool;
@@ -152,7 +160,7 @@ class MapEditor {
// Estado del editor
bool active_{false};
DragState drag_;
Selection selection_; // Entidad seleccionada (unificada: enemy, item o platform)
Selection selection_; // Entidad seleccionada (unificada: enemy, item o platform)
static constexpr int NO_BRUSH = -2; // Sin brush activo
static constexpr int ERASER_BRUSH = -1; // Brush borrador (pinta tile vacío = -1)
int brush_tile_{NO_BRUSH}; // Tile activo para pintar