stratgame
diff src/menu_part.cc @ 0:86b53f76899f
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 21 May 2012 19:07:40 +0300 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/menu_part.cc Mon May 21 19:07:40 2012 +0300 1.3 @@ -0,0 +1,48 @@ 1.4 +#include <stdlib.h> 1.5 +#include <imtk.h> 1.6 +#include "opengl.h" 1.7 +#include "part.h" 1.8 +#include "game_part.h" 1.9 +#include "menu_part.h" 1.10 + 1.11 +static int width, height; 1.12 + 1.13 + 1.14 +MainMenu::~MainMenu() {} 1.15 + 1.16 +void MainMenu::draw() const 1.17 +{ 1.18 + glClear(GL_COLOR_BUFFER_BIT); 1.19 + 1.20 + imtk_begin(); 1.21 + 1.22 + imtk_layout_start(width / 2, height / 2); 1.23 + imtk_layout_dir(IMTK_VERTICAL); 1.24 + imtk_layout_spacing(10); 1.25 + 1.26 + if(imtk_button(IMUID, "Play", IMTK_AUTO, IMTK_AUTO)) { 1.27 + cur_part = game_part; 1.28 + } 1.29 + if(imtk_button(IMUID, "Quit", IMTK_AUTO, IMTK_AUTO)) { 1.30 + exit(0); 1.31 + } 1.32 + 1.33 + imtk_end(); 1.34 +} 1.35 + 1.36 +void MainMenu::reshape(int x, int y) 1.37 +{ 1.38 + imtk_set_viewport(x, y); 1.39 + width = x; 1.40 + height = y; 1.41 +} 1.42 + 1.43 +void MainMenu::mouse_button(int bn, bool pressed) 1.44 +{ 1.45 + imtk_inp_mouse(bn, pressed ? 1 : 0); 1.46 +} 1.47 + 1.48 +void MainMenu::mouse_motion(int x, int y) 1.49 +{ 1.50 + imtk_inp_motion(x, y); 1.51 +}