stratgame

view src/game_part.cc @ 2:369b51c9e4a8

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 23 May 2012 07:25:43 +0300
parents 86b53f76899f
children 8d95187cb3ee
line source
1 #include "opengl.h"
2 #include "game_part.h"
3 #include "level.h"
5 Game::~Game() {}
7 bool Game::init()
8 {
9 if(!level.load("data/test.level")) {
10 return false;
11 }
12 return true;
13 }
15 void Game::draw() const
16 {
17 glClear(GL_COLOR_BUFFER_BIT);
19 glMatrixMode(GL_MODELVIEW);
20 glLoadIdentity();
21 glRotatef(current_time / 100.0, 0, 0, 1);
22 glScalef(0.5, 0.5, 1);
24 glBegin(GL_QUADS);
25 glColor3f(1, 0, 0);
26 glVertex2f(-1, -1);
27 glColor3f(0, 1, 0);
28 glVertex2f(1, -1);
29 glColor3f(0, 0, 1);
30 glVertex2f(1, 1);
31 glColor3f(1, 0, 1);
32 glVertex2f(-1, 1);
33 glEnd();
34 }
36 void Game::key(int key, bool pressed)
37 {
38 switch(key) {
39 case 27:
40 cur_part = menu_part;
41 break;
43 default:
44 break;
45 }
46 }