blob: 5e1b9a5301b85adb42c4ce951cf56a65d2b05d73 (
plain)
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
|
/*****************************************************
* File: Driver.cpp
* Author: Br. Burton
*
* Description: This file contains the main function
* that starts the game and the callback function
* that specifies what methods of the game class are
* called each time through the game loop.
******************************************************/
#include "game.h"
#include "uiInteract.h"
/*************************************
* All the interesting work happens here, when
* I get called back from OpenGL to draw a frame.
* When I am finished drawing, then the graphics
* engine will wait until the proper amount of
* time has passed and put the drawing on the screen.
**************************************/
void callBack(const Interface *pUI, void *p)
{
Game *pGame = (Game *)p;
pGame->advance();
pGame->draw(*pUI);
pGame->handleInput(*pUI);
}
/*********************************
* Main is pretty sparse. Just initialize
* the game and call the display engine.
* That is all!
*********************************/
int main(int argc, char ** argv)
{
Point topLeft(-200, 200);
Point bottomRight(200, -200);
Interface ui(argc, argv, "Asteroids", topLeft, bottomRight);
Game game(topLeft, bottomRight);
ui.run(callBack, &game);
return 0;
}
|