-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
64 lines (51 loc) · 1.58 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
58
59
60
61
62
63
64
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <windows.h>
#include <ctime>
#include <iostream>
#include "Destination.h"
#include<fstream>
#include<string>
#include<cctype>
#include <Map.h>
#include "Scene.h"
#include "RaceScene.h"
#include "StatsScene.h"
#include "Voiture.h"
#include "MenuScene.h"
using namespace std;
sf::RenderWindow window;
Voiture* player1 = new Voiture("pickUp.png");
Voiture* player2 = new Voiture("tank.png");
//Scene* current_scene = new StatsScene(*player1, *player2, 10);
//Scene* current_scene = new MenuScene();
Scene* current_scene = new MenuScene();
//Scene* current_scene = new RaceScene();
//Scene* current_scene = new StatsScene(*player1, *player2, 10);
/**
Function to handle events of the main loop, like the one to close the window.
*/
void processGlobalEvents()
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
}
int main()
{
int window_width = 1000;
int window_height = 500;
window.create(sf::VideoMode(window_width, window_height), "Zombie Derby!");
//Pas certain que ça va là...
player1->getSprite()->setOrigin((float)(player1->getSprite()->getGlobalBounds().width /2),(float)(player1->getSprite()->getGlobalBounds().height)/2);
player2->getSprite()->setOrigin((float)(player2->getSprite()->getGlobalBounds().width /2),(float)(player2->getSprite()->getGlobalBounds().height)/2);
while (window.isOpen())
{
processGlobalEvents();
current_scene->process();
}
return 0;
}