stratgame

diff src/game_part.cc @ 0:86b53f76899f

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 21 May 2012 19:07:40 +0300
parents
children 369b51c9e4a8
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/game_part.cc	Mon May 21 19:07:40 2012 +0300
     1.3 @@ -0,0 +1,38 @@
     1.4 +#include "opengl.h"
     1.5 +#include "game_part.h"
     1.6 +#include "level.h"
     1.7 +
     1.8 +Game::~Game() {}
     1.9 +
    1.10 +void Game::draw() const
    1.11 +{
    1.12 +	glClear(GL_COLOR_BUFFER_BIT);
    1.13 +
    1.14 +	glMatrixMode(GL_MODELVIEW);
    1.15 +	glLoadIdentity();
    1.16 +	glRotatef(current_time / 100.0, 0, 0, 1);
    1.17 +	glScalef(0.5, 0.5, 1);
    1.18 +
    1.19 +	glBegin(GL_QUADS);
    1.20 +	glColor3f(1, 0, 0);
    1.21 +	glVertex2f(-1, -1);
    1.22 +	glColor3f(0, 1, 0);
    1.23 +	glVertex2f(1, -1);
    1.24 +	glColor3f(0, 0, 1);
    1.25 +	glVertex2f(1, 1);
    1.26 +	glColor3f(1, 0, 1);
    1.27 +	glVertex2f(-1, 1);
    1.28 +	glEnd();
    1.29 +}
    1.30 +
    1.31 +void Game::key(int key, bool pressed)
    1.32 +{
    1.33 +	switch(key) {
    1.34 +	case 27:
    1.35 +		cur_part = menu_part;
    1.36 +		break;
    1.37 +
    1.38 +	default:
    1.39 +		break;
    1.40 +	}
    1.41 +}