collision map

This commit is contained in:
2026-04-06 20:27:35 +02:00
parent ef04500a44
commit 98715ef3a7
36 changed files with 489 additions and 297 deletions

View File

@@ -72,7 +72,7 @@ class Screen {
void nextShader(); // Cicla al siguiente shader disponible (para futura UI)
// Render offset (para transiciones de pantalla)
void setRenderOffset(int x, int y); // Establece el offset de renderizado
void setRenderOffset(int x, int y); // Establece el offset de renderizado
[[nodiscard]] auto getRenderOffsetX() const -> int { return render_offset_x_; }
[[nodiscard]] auto getRenderOffsetY() const -> int { return render_offset_y_; }

View File

@@ -48,13 +48,13 @@ class Text {
auto writeToSurface(const std::string& text, int zoom = 1, int kerning = 1) -> std::shared_ptr<Surface>; // Escribe el texto en una textura
auto writeDXToSurface(Uint8 flags, const std::string& text, int kerning = 1, Uint8 text_color = Uint8(), Uint8 shadow_distance = 1, Uint8 shadow_color = Uint8(), int lenght = -1) -> std::shared_ptr<Surface>; // Escribe el texto con extras en una textura
void writeColoredMono(int x, int y, const std::string& text, Uint8 color, int cell_w); // Escribe texto monoespaciado con color
[[nodiscard]] auto length(const std::string& text, int kerning = 1) const -> int; // Obtiene la longitud en pixels de una cadena
[[nodiscard]] auto lengthMono(const std::string& text, int cell_w) const -> int; // Obtiene la longitud en pixels de una cadena monoespaciada
[[nodiscard]] auto getCharacterSize() const -> int; // Devuelve el tamaño del caracter
[[nodiscard]] auto glyphWidth(uint32_t codepoint, int kerning = 0) const -> int; // Devuelve el ancho en pixels de un glifo
[[nodiscard]] auto getGlyphClip(uint32_t codepoint) const -> SDL_FRect; // Devuelve el clip rect del glifo
[[nodiscard]] auto getSprite() const -> Sprite* { return sprite_.get(); } // Acceso al sprite interno
void writeColoredMono(int x, int y, const std::string& text, Uint8 color, int cell_w); // Escribe texto monoespaciado con color
[[nodiscard]] auto length(const std::string& text, int kerning = 1) const -> int; // Obtiene la longitud en pixels de una cadena
[[nodiscard]] auto lengthMono(const std::string& text, int cell_w) const -> int; // Obtiene la longitud en pixels de una cadena monoespaciada
[[nodiscard]] auto getCharacterSize() const -> int; // Devuelve el tamaño del caracter
[[nodiscard]] auto glyphWidth(uint32_t codepoint, int kerning = 0) const -> int; // Devuelve el ancho en pixels de un glifo
[[nodiscard]] auto getGlyphClip(uint32_t codepoint) const -> SDL_FRect; // Devuelve el clip rect del glifo
[[nodiscard]] auto getSprite() const -> Sprite* { return sprite_.get(); } // Acceso al sprite interno
void setFixedWidth(bool value); // Establece si se usa un tamaño fijo de letra

View File

@@ -40,7 +40,8 @@ namespace Resource {
// Constructor
Cache::Cache(LoadingMode mode)
: loading_mode_(mode), loading_text_(Screen::get()->getText()) {
: loading_mode_(mode),
loading_text_(Screen::get()->getText()) {
load();
}

View File

@@ -17,8 +17,8 @@ namespace Resource {
};
static void init(LoadingMode mode = LoadingMode::EAGER); // Inicialización singleton
static void destroy(); // Destrucción singleton
static auto get() -> Cache*; // Acceso al singleton
static void destroy(); // Destrucción singleton
static auto get() -> Cache*; // Acceso al singleton
auto getSound(const std::string& name) -> JA_Sound_t*; // Getters de recursos
auto getMusic(const std::string& name) -> JA_Music_t*;

View File

@@ -136,7 +136,10 @@ void Debug::loadFromFile() {
auto yaml = fkyaml::node::deserialize(content);
// Detecta si falta alguna clave esperada para regenerar el fichero con los nuevos defaults
for (const char* key : {"room", "spawn_x", "spawn_y", "spawn_flip", "initial_scene", "lazy_loading", "render_info"}) {
if (!yaml.contains(key)) { needs_save = true; break; }
if (!yaml.contains(key)) {
needs_save = true;
break;
}
}
if (yaml.contains("room")) {
spawn_settings_.room = yaml["room"].get_value<std::string>();

View File

@@ -47,7 +47,7 @@ class Debug {
void setSpawnSettings(const SpawnSettings& s) { spawn_settings_ = s; } // Establece los valores de spawn
[[nodiscard]] auto getInitialScene() const -> SceneManager::Scene { return initial_scene_; } // Obtiene la escena inicial de debug
void setInitialScene(SceneManager::Scene s) { initial_scene_ = s; } // Establece la escena inicial de debug
[[nodiscard]] auto getLazyLoading() const -> bool { return lazy_loading_; } // Indica si el modo lazy de recursos está activo
[[nodiscard]] auto getLazyLoading() const -> bool { return lazy_loading_; } // Indica si el modo lazy de recursos está activo
[[nodiscard]] auto getRenderInfoEnabled() const -> bool { return render_info_enabled_; } // Indica si el overlay RenderInfo arranca activo
private:

View File

@@ -166,8 +166,8 @@ Director::Director() {
// Initialize resources (works for both release and development)
#ifdef _DEBUG
Resource::Cache::init(Debug::get()->getLazyLoading()
? Resource::Cache::LoadingMode::LAZY
: Resource::Cache::LoadingMode::EAGER);
? Resource::Cache::LoadingMode::LAZY
: Resource::Cache::LoadingMode::EAGER);
#else
Resource::Cache::init();
#endif

View File

@@ -13,9 +13,9 @@ class Game;
class Director {
public:
Director(); // Constructor
~Director(); // Destructor
auto iterate() -> SDL_AppResult; // Una iteración del bucle principal (callback model)
Director(); // Constructor
~Director(); // Destructor
auto iterate() -> SDL_AppResult; // Una iteración del bucle principal (callback model)
private:
// --- Variables ---