-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMinClient.cpp
More file actions
51 lines (35 loc) · 1.18 KB
/
MinClient.cpp
File metadata and controls
51 lines (35 loc) · 1.18 KB
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
#include "MinClient.h"
int main(int argc, char *argv[]){
Engine::init();
Camera camera;
SDLstuff sdlstuff;
OpenGLstuff openglstuff(sdlstuff.getMainWindow());
OpenGLES2stuff::init();
minclient::Font::init(sdlstuff.getMainWindow());
sdlstuff.tweakFontSize();
sdlstuff.printResolution();
openglstuff.printCompressedTextureAvailability();
NetworkStuff networkStuff(&camera, &openglstuff);
// main game loop
while(!Engine::done) {
doGameLoop(&sdlstuff, &camera, &openglstuff, &networkStuff);
}
sdlstuff.closeSDL_Net();
sdlstuff.ungrabKeyAndMouse();
cout << "MinClient: Leaving now..." << endl;
// FIXME: without the exit here it hangs. need to find out what causes this.
exit(1);
return 0;
}
void doGameLoop(SDLstuff* sdlstuff, Camera* camera, OpenGLstuff* openglstuff, NetworkStuff* networkStuff){
sdlstuff->checkEvents();
Engine::calculateFrameRate();
camera->update();
#ifdef NETWORK_ON
networkStuff->sendMessageToRenderServers();
networkStuff->receiveMessageFromRenderServer();
#endif
openglstuff->render();
openglstuff->swapBuffers();
Engine::increaseNumFramesRendered();
}