Implementado el cambio de habitación

This commit is contained in:
2022-07-03 14:53:18 +02:00
parent 7d0262a30e
commit 0bb7b6441a
6 changed files with 145 additions and 45 deletions

View File

@@ -179,14 +179,14 @@ void Room::fillMapTexture()
// Los tilesets son de 20x20 tiles. El primer tile es el 1. Cuentan hacia la derecha y hacia abajo
printf("Filling map\n");
// printf("Filling map\n");
SDL_Rect clip = {0, 0, 8, 8};
for (int y = 0; y < 16; y++)
for (int x = 0; x < 32; x++)
{
{
clip.x = ((tilemap[(y * 32) + x] - 1) % 20) * 8;
clip.y = ((tilemap[(y * 32) + x] - 1) / 20) * 8;
printf("tilemap [%i] = %i | x = %i | y = %i\n", ((y * 32) + x), tilemap[(y * 32) + x], clip.x, clip.y);
// printf("tilemap [%i] = %i | x = %i | y = %i\n", ((y * 32) + x), tilemap[(y * 32) + x], clip.x, clip.y);
texture->render(renderer, x * 8, y * 8, &clip);
}
@@ -200,4 +200,28 @@ void Room::drawMap()
// Dibuja la textura con el mapa en pantalla
SDL_RenderCopy(renderer, map_texture, &rect, NULL);
}
// Devuelve el valor de la variable
std::string Room::getRoomUp()
{
return room_up;
}
// Devuelve el valor de la variable
std::string Room::getRoomDown()
{
return room_down;
}
// Devuelve el valor de la variable
std::string Room::getRoomLeft()
{
return room_left;
}
// Devuelve el valor de la variable
std::string Room::getRoomRight()
{
return room_right;
}