passat el codi de pintar el mode debug de textura a surface

This commit is contained in:
2025-03-20 18:02:31 +01:00
parent f438e8946b
commit 0667e2105b
5 changed files with 91 additions and 109 deletions

View File

@@ -40,7 +40,7 @@ Game::Game(GameMode mode)
#endif
{
#ifdef DEBUG
Debug::get()->setEnabled(false);
Debug::get()->setEnabled(true);
#endif
// Crea objetos e inicializa variables
@@ -202,32 +202,34 @@ void Game::updateDebugInfo()
// Pone la información de debug en pantalla
void Game::renderDebugInfo()
{
/*
if (!Debug::get()->getEnabled())
{
return;
}
auto surface = Screen::get()->getRendererSurface();
// Borra el marcador
SDL_Rect rect = {0, 18 * BLOCK, PLAY_AREA_WIDTH, GAMECANVAS_HEIGHT - PLAY_AREA_HEIGHT};
SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0, 0, 0, 255);
SDL_RenderFillRect(Screen::get()->getRenderer(), &rect);
surface->fillRect(&rect, static_cast<Uint8>(PaletteColor::BLACK));
// Pinta la rejilla
SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 255, 255, 255, 32);
for (int i = 0; i < PLAY_AREA_BOTTOM; i += 8)
{ // Lineas horizontales
SDL_RenderDrawLine(Screen::get()->getRenderer(), 0, i, PLAY_AREA_RIGHT, i);
/*for (int i = 0; i < PLAY_AREA_BOTTOM; i += 8)
{
// Lineas horizontales
surface->drawLine(0, i, PLAY_AREA_RIGHT, i, static_cast<Uint8>(PaletteColor::BRIGHT_BLACK));
}
for (int i = 0; i < PLAY_AREA_RIGHT; i += 8)
{ // Lineas verticales
SDL_RenderDrawLine(Screen::get()->getRenderer(), i, 0, i, PLAY_AREA_BOTTOM - 1);
}
{
// Lineas verticales
surface->drawLine(i, 0, i, PLAY_AREA_BOTTOM - 1, static_cast<Uint8>(PaletteColor::BRIGHT_BLACK));
}*/
// Pinta el texto
Debug::get()->setPos({1, 18 * 8});
Debug::get()->render();
*/
}
// Comprueba los eventos