añadidos nuevos ficheros de clases
This commit is contained in:
@@ -17,40 +17,34 @@ Repres un 14 de febrer de 2021
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include "const.h"
|
||||
#include "game.h"
|
||||
#include "director.h"
|
||||
|
||||
int main(int argc, char *args[])
|
||||
{
|
||||
// Inicia el generador de numeros aleatorios
|
||||
srand(time(nullptr));
|
||||
|
||||
// Crea el objeto game
|
||||
Game *game = new Game();
|
||||
// Crea el objeto director
|
||||
Director *director = new Director(args[0]);
|
||||
|
||||
// Establece el valor de la variable con el path del ejecutable
|
||||
game->setPath(args[0]);
|
||||
|
||||
// Inicializa la lista de ficheros
|
||||
game->setFileList();
|
||||
|
||||
// Comprueba que existen todos los ficheros
|
||||
if (!game->checkFileList())
|
||||
{
|
||||
// Comprueba si existen todos los ficheros de recursos
|
||||
if (!director->initResourceList())
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Arranca SDL y crea la ventana
|
||||
if (!game->initSDL())
|
||||
{
|
||||
printf("Failed to initialize!\n");
|
||||
if (!director->initSDL())
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Libera todos los recursos y cierra SDL
|
||||
delete game;
|
||||
printf("Shutting down the game...\n");
|
||||
|
||||
return 0;
|
||||
director->initGame();
|
||||
while (director->isRunning())
|
||||
{
|
||||
director->runGame();
|
||||
}
|
||||
director->quitGame();
|
||||
|
||||
// Libera todos los recursos y cierra SDL
|
||||
delete director;
|
||||
printf("Shutting down the game...\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user