stratgame
annotate src/menu_part.cc @ 3:8d95187cb3ee
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 23 May 2012 17:10:46 +0300 |
parents | |
children |
rev | line source |
---|---|
nuclear@0 | 1 #include <stdlib.h> |
nuclear@0 | 2 #include <imtk.h> |
nuclear@0 | 3 #include "opengl.h" |
nuclear@0 | 4 #include "part.h" |
nuclear@0 | 5 #include "game_part.h" |
nuclear@0 | 6 #include "menu_part.h" |
nuclear@0 | 7 |
nuclear@0 | 8 static int width, height; |
nuclear@0 | 9 |
nuclear@0 | 10 |
nuclear@0 | 11 MainMenu::~MainMenu() {} |
nuclear@0 | 12 |
nuclear@0 | 13 void MainMenu::draw() const |
nuclear@0 | 14 { |
nuclear@0 | 15 glClear(GL_COLOR_BUFFER_BIT); |
nuclear@0 | 16 |
nuclear@0 | 17 imtk_begin(); |
nuclear@0 | 18 |
nuclear@0 | 19 imtk_layout_start(width / 2, height / 2); |
nuclear@0 | 20 imtk_layout_dir(IMTK_VERTICAL); |
nuclear@0 | 21 imtk_layout_spacing(10); |
nuclear@0 | 22 |
nuclear@0 | 23 if(imtk_button(IMUID, "Play", IMTK_AUTO, IMTK_AUTO)) { |
nuclear@0 | 24 cur_part = game_part; |
nuclear@0 | 25 } |
nuclear@0 | 26 if(imtk_button(IMUID, "Quit", IMTK_AUTO, IMTK_AUTO)) { |
nuclear@0 | 27 exit(0); |
nuclear@0 | 28 } |
nuclear@0 | 29 |
nuclear@0 | 30 imtk_end(); |
nuclear@0 | 31 } |
nuclear@0 | 32 |
nuclear@0 | 33 void MainMenu::reshape(int x, int y) |
nuclear@0 | 34 { |
nuclear@0 | 35 imtk_set_viewport(x, y); |
nuclear@0 | 36 width = x; |
nuclear@0 | 37 height = y; |
nuclear@0 | 38 } |
nuclear@0 | 39 |
nuclear@0 | 40 void MainMenu::mouse_button(int bn, bool pressed) |
nuclear@0 | 41 { |
nuclear@0 | 42 imtk_inp_mouse(bn, pressed ? 1 : 0); |
nuclear@0 | 43 } |
nuclear@0 | 44 |
nuclear@0 | 45 void MainMenu::mouse_motion(int x, int y) |
nuclear@0 | 46 { |
nuclear@0 | 47 imtk_inp_motion(x, y); |
nuclear@0 | 48 } |