-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
57 lines (47 loc) · 1.57 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
Todo el equipo While se compromete y comprometió al código de honor:
"No hemos brindado ni recibido asistencia no autorizada en este proyecto"
*/
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Audio/Music.hpp>
#include <SFML/Audio/Sound.hpp>
#include "Chess.h"
#include "ChessScreens.h"
#include "ChessGameScreen.h"
#include "ChessMenuScreen.h"
#include "ChessPauseScreen.h"
#include "ChessCreditsScreen.h"
#include "ChessExceptions.h"
#include <iostream>
using namespace std;
using namespace sf;
//Variables estaticas para el tamaño de la ventana
static const int WINDOW_HORIZONTAL_SIZE=1067;
//Variables estaticas para el tamaño de la ventana
static const int WINDOW_VERTICAL_SIZE=ChessCoord::SIZE*8;
int main()
{
//Configuracion de la ventana del juego
RenderWindow window(VideoMode(WINDOW_HORIZONTAL_SIZE, WINDOW_VERTICAL_SIZE), "Chess");
ChessScreen** screens=new ChessScreen*[5];
screens[0]=new ChessScreen(); // Pantalla vacía, no hace nada
screens[1]=new ChessMenuScreen(); // Pantalla 1
screens[2]=new ChessGameScreen(); // Pantalla 2
screens[3]=new ChessPauseScreen(); // Pantalla 3
screens[4]=new ChessCreditsScreen(); // Pantalla 4
int currentScreen=1;
int nextScreen=currentScreen;
while(currentScreen>=1){
nextScreen=screens[currentScreen]->Run(window);
if(nextScreen!=currentScreen){
screens[currentScreen]->Pause();
currentScreen=nextScreen;
}
}
for(int i=0; i<=4; i++){
delete screens[i];
}
delete[] screens;
return 0;
}