forked from jaildesigner-jailgames/jaildoctors_dilemma
Ya casi dibuja el mapa
This commit is contained in:
@@ -105,11 +105,11 @@ section_t Game::run()
|
|||||||
mRoom->draw();
|
mRoom->draw();
|
||||||
|
|
||||||
// Escribe las medidas de ancho y alto de la pantalla
|
// Escribe las medidas de ancho y alto de la pantalla
|
||||||
mText->writeCentered(GAMECANVAS_CENTER_X, 0, std::to_string(GAMECANVAS_WIDTH), -1);
|
// mText->writeCentered(GAMECANVAS_CENTER_X, 0, std::to_string(GAMECANVAS_WIDTH), -1);
|
||||||
mText->write(0, GAMECANVAS_CENTER_Y - (mText->getCharacterWidth() / 2), std::to_string(GAMECANVAS_HEIGHT), -1);
|
// mText->write(0, GAMECANVAS_CENTER_Y - (mText->getCharacterWidth() / 2), std::to_string(GAMECANVAS_HEIGHT), -1);
|
||||||
|
|
||||||
// Texto en el centro de la pantalla
|
// Texto en el centro de la pantalla
|
||||||
mText->writeCentered(GAMECANVAS_CENTER_X, GAMECANVAS_CENTER_Y - (mText->getCharacterWidth() / 2), mRoom->getName(), -1);
|
mText->writeCentered(GAMECANVAS_CENTER_X, 18 * 8, mRoom->getName(), -1);
|
||||||
|
|
||||||
// Actualiza la pantalla
|
// Actualiza la pantalla
|
||||||
mScreen->blit();
|
mScreen->blit();
|
||||||
|
|||||||
@@ -161,8 +161,12 @@ color_t Room::getBGColor()
|
|||||||
// Dibuja la habitación en pantalla
|
// Dibuja la habitación en pantalla
|
||||||
void Room::draw()
|
void Room::draw()
|
||||||
{
|
{
|
||||||
int x = 0;
|
|
||||||
int y = 0;
|
|
||||||
SDL_Rect clip = {0, 0, 8, 8};
|
SDL_Rect clip = {0, 0, 8, 8};
|
||||||
texture->render(renderer,x, y, &clip);
|
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;
|
||||||
|
texture->render(renderer, x * 8, y * 8, &clip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user