stratgame

annotate 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
rev   line source
nuclear@0 1 #include "opengl.h"
nuclear@0 2 #include "game_part.h"
nuclear@0 3 #include "level.h"
nuclear@0 4
nuclear@0 5 Game::~Game() {}
nuclear@0 6
nuclear@0 7 void Game::draw() const
nuclear@0 8 {
nuclear@0 9 glClear(GL_COLOR_BUFFER_BIT);
nuclear@0 10
nuclear@0 11 glMatrixMode(GL_MODELVIEW);
nuclear@0 12 glLoadIdentity();
nuclear@0 13 glRotatef(current_time / 100.0, 0, 0, 1);
nuclear@0 14 glScalef(0.5, 0.5, 1);
nuclear@0 15
nuclear@0 16 glBegin(GL_QUADS);
nuclear@0 17 glColor3f(1, 0, 0);
nuclear@0 18 glVertex2f(-1, -1);
nuclear@0 19 glColor3f(0, 1, 0);
nuclear@0 20 glVertex2f(1, -1);
nuclear@0 21 glColor3f(0, 0, 1);
nuclear@0 22 glVertex2f(1, 1);
nuclear@0 23 glColor3f(1, 0, 1);
nuclear@0 24 glVertex2f(-1, 1);
nuclear@0 25 glEnd();
nuclear@0 26 }
nuclear@0 27
nuclear@0 28 void Game::key(int key, bool pressed)
nuclear@0 29 {
nuclear@0 30 switch(key) {
nuclear@0 31 case 27:
nuclear@0 32 cur_part = menu_part;
nuclear@0 33 break;
nuclear@0 34
nuclear@0 35 default:
nuclear@0 36 break;
nuclear@0 37 }
nuclear@0 38 }