merdetes pa debugar a gust

This commit is contained in:
2025-11-14 17:58:32 +01:00
parent 8893e8f05b
commit 710e7cc8c1
9 changed files with 89 additions and 42 deletions

View File

@@ -8,9 +8,7 @@
#include "utils/utils.hpp"
// Constructor
TilemapRenderer::TilemapRenderer(std::vector<int> tile_map, int tile_set_width,
std::shared_ptr<Surface> tileset_surface, std::string bg_color,
int conveyor_belt_direction)
TilemapRenderer::TilemapRenderer(std::vector<int> tile_map, int tile_set_width, std::shared_ptr<Surface> tileset_surface, std::string bg_color, int conveyor_belt_direction)
: tile_map_(std::move(tile_map)),
tile_set_width_(tile_set_width),
tileset_surface_(std::move(tileset_surface)),
@@ -47,7 +45,7 @@ void TilemapRenderer::render() {
// Dibuja los tiles animados
#ifdef _DEBUG
if (!Debug::get()->getEnabled()) {
if (!Debug::get()->isEnabled()) {
renderAnimatedTiles();
}
#else
@@ -55,6 +53,13 @@ void TilemapRenderer::render() {
#endif
}
#ifdef _DEBUG
// Redibuja el tilemap (para actualizar modo debug)
void TilemapRenderer::redrawMap(const CollisionMap* collision_map) {
fillMapTexture(collision_map);
}
#endif
// Pinta el mapa estático y debug lines
void TilemapRenderer::fillMapTexture(const CollisionMap* collision_map) {
const Uint8 COLOR = stringToColor(bg_color_);
@@ -77,13 +82,20 @@ void TilemapRenderer::fillMapTexture(const CollisionMap* collision_map) {
if (B && !A) {
clip.x = (tile_map_[INDEX] % tile_set_width_) * TILE_SIZE;
clip.y = (tile_map_[INDEX] / tile_set_width_) * TILE_SIZE;
#ifdef _DEBUG
if (!Debug::get()->isEnabled()) {
tileset_surface_->render(x * TILE_SIZE, y * TILE_SIZE, &clip);
}
#else
tileset_surface_->render(x * TILE_SIZE, y * TILE_SIZE, &clip);
#endif
}
}
}
#ifdef _DEBUG
if (Debug::get()->getEnabled()) {
// Pinta las superficies en el modo debug
if (Debug::get()->isEnabled()) {
auto surface = Screen::get()->getRendererSurface();
// BottomSurfaces