- Treballant en gamestate_play

This commit is contained in:
2023-10-16 18:58:27 +02:00
parent 4c430ec512
commit aa6b79c9ac
3 changed files with 63 additions and 2 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
*.exe
arounders
arounders_debug
*.dll

View File

@@ -6,6 +6,49 @@ namespace gamestate
{
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);
}
}
}

View File

@@ -39,6 +39,8 @@ namespace gamestate
bool loop()
{
static bool salir = false;
const int x = input::mouseX();
const int y = input::mouseY();
@@ -63,6 +65,21 @@ namespace gamestate
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;
}