forked from jaildesigner-jailgames/jaildoctors_dilemma
Ya pinta correctamente la habitación
This commit is contained in:
@@ -177,12 +177,16 @@ void Room::fillMapTexture()
|
||||
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0x00);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
// Los tilesets son de 20x20 tiles. El primer tile es el 1. Cuentan hacia la derecha y hacia abajo
|
||||
|
||||
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 * 16) + x] * 8;
|
||||
clip.y = tilemap[(y * 16) + x] * 8;
|
||||
{
|
||||
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);
|
||||
texture->render(renderer, x * 8, y * 8, &clip);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user