-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
executable file
·46 lines (42 loc) · 1.13 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
#include"Classes.h"
using namespace std;
void gameLoop(Control* control, MySDL* win1);
int main() {
int teamSize=5;
srand (time(NULL));
Texture tex("./map_txt/map1_out.txt",MySDL::GAME_MAP_WIDTH,MySDL::GAME_WINDOW_HEIGHT);
Input input;
Control control(&tex);
control.setInputRef(&input);
MySDL win1;
win1.setControl(&control);
win1.Init();
win1.setTextureRef(&tex);
win1.CreateWinRen("worms");
win1.DrawLoadingScreen();
control.setSrcdestRef(win1.getSrcdestRef());
control.createTeams(teamSize);
thread mainGameLoop(gameLoop,&control,&win1);
//inputs
while(!Control::exitGame){
input.getEvents();
SDL_Delay(1000/480);
}
// cout<<"end"<<endl;
mainGameLoop.join();
control.clearTeams();
win1.DestroyWin();
return 0;
}
void gameLoop(Control* control, MySDL* win1){
while(!Control::exitGame){
// cout<<"animating: "<<Control::animating()<<endl;
control->handleEvents();
control->logic();
win1->drawGame();
SDL_Delay(2000/60);
if (Control::delay){
SDL_Delay(2000);
}
}
}