- [FIX] Al carregar el mapa nomes contaba fins a x=10 en compte de 20. - Aplicats els nous draw::draw() - Fora tots els draw::setTrans(), el color transparent no canvia en tot el joc.
78 lines
1.8 KiB
C++
78 lines
1.8 KiB
C++
#include "gamestates.h"
|
|
#include "jgame.h"
|
|
#include <string>
|
|
#include "aux_font.h"
|
|
#include "proc_mapa.h"
|
|
|
|
namespace gamestate
|
|
{
|
|
namespace prefase
|
|
{
|
|
// Variables del gamestate
|
|
draw::surface *fondo = nullptr;
|
|
draw::surface *cursor = nullptr;
|
|
|
|
// Mètodes del gamestate
|
|
bool loop();
|
|
|
|
void init()
|
|
{
|
|
// Carrega el gif del fondo
|
|
fondo = draw::loadSurface("prefase.gif", true);
|
|
cursor = draw::loadSurface("cursor.gif");
|
|
|
|
// Carrega el mapa
|
|
mapa::carregar();
|
|
|
|
// Pinta el text en el fondo
|
|
draw::setDestination(fondo);
|
|
font::selectFont(font::type::normal);
|
|
|
|
font::print(130, 60, "NIVELL");
|
|
font::print(179, 60, game::getConfig("fase")+1);
|
|
|
|
font::print(80, 100, mapa::arounders::totals);
|
|
font::print(101, 100, "AROUNDERS DISPONIBLES");
|
|
|
|
font::print(80, 110, mapa::arounders::necessaris);
|
|
font::print(101, 110, "AROUNDERS NECESSARIS");
|
|
|
|
draw::setDestination(nullptr);
|
|
|
|
// Comencem el bucle
|
|
draw::fadein();
|
|
game::setState(gamestate::prefase::loop);
|
|
}
|
|
|
|
bool loop()
|
|
{
|
|
static bool salir = false;
|
|
|
|
draw::draw(fondo);
|
|
|
|
draw::setSource(cursor);
|
|
draw::draw(input::mouseX(), input::mouseY());
|
|
|
|
draw::render();
|
|
|
|
if (draw::isfading()) return true;
|
|
|
|
if (salir)
|
|
{
|
|
salir = false;
|
|
gamestate::play::init();
|
|
return true;
|
|
}
|
|
|
|
if (input::anyKeyPressed() || input::mouseBtn(1))
|
|
{
|
|
draw::fadeout();
|
|
salir = true;
|
|
return true;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
}
|
|
}
|