- Treballant en gamestate_play
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
.vscode/*
|
.vscode/*
|
||||||
*.exe
|
*.exe
|
||||||
arounders
|
arounders
|
||||||
arounders_debug
|
arounders_debug
|
||||||
|
*.dll
|
||||||
@@ -6,6 +6,49 @@ namespace gamestate
|
|||||||
{
|
{
|
||||||
namespace play
|
namespace play
|
||||||
{
|
{
|
||||||
|
draw::surface *fondo = nullptr;
|
||||||
|
draw::surface *mapa = nullptr;
|
||||||
|
|
||||||
|
void carregarMapa();
|
||||||
|
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
// Carregar el fondo que toque i la seua paleta (que nomes usa els colors del 128 al 255)
|
||||||
|
char arxiuFondo[10] = "BKG00.GIF";
|
||||||
|
arxiuFondo[4] = (game::getConfig("fase") % 10) + 48;
|
||||||
|
fondo = draw::loadSurface(arxiuFondo, true);
|
||||||
|
|
||||||
|
// Carregar la paleta estandar
|
||||||
|
uint32_t *pal = draw::loadPalette("tiles.gif");
|
||||||
|
draw::setPalette(pal, 128);
|
||||||
|
|
||||||
|
// [TODO] Carreagar la resta de gifs que facen falta
|
||||||
|
//font1 = drawManager->LoadFont("fuente1.gif");
|
||||||
|
//cursor = drawManager->LoadFont("cursor.gif");
|
||||||
|
//puerta = drawManager->LoadFont("puerta.gif");
|
||||||
|
//marca = drawManager->LoadFont("marca.gif");
|
||||||
|
//menu = drawManager->LoadFont("menu.gif");
|
||||||
|
|
||||||
|
// [TODO] CREAR AIGUA PROCESSOR
|
||||||
|
// [TODO] CREAR MARCADOR PROCESSOR
|
||||||
|
|
||||||
|
carregarMapa();
|
||||||
|
}
|
||||||
|
|
||||||
|
void carregarMapa()
|
||||||
|
{
|
||||||
|
FILE *f = file::getFilePointer("mapes.txt");
|
||||||
|
|
||||||
|
const int fase = game::getConfig("fase");
|
||||||
|
int val;
|
||||||
|
do {
|
||||||
|
fscanf(f, "LEVEL %i", &val);
|
||||||
|
} while (val != fase);
|
||||||
|
|
||||||
|
int tileset=0;
|
||||||
|
fscanf(f, "tileset = %i", &tileset);
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,6 +39,8 @@ namespace gamestate
|
|||||||
|
|
||||||
bool loop()
|
bool loop()
|
||||||
{
|
{
|
||||||
|
static bool salir = false;
|
||||||
|
|
||||||
const int x = input::mouseX();
|
const int x = input::mouseX();
|
||||||
const int y = input::mouseY();
|
const int y = input::mouseY();
|
||||||
|
|
||||||
@@ -63,6 +65,21 @@ namespace gamestate
|
|||||||
|
|
||||||
draw::render();
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user