stratgame

view 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 source
1 #include <stdlib.h>
2 #include <imtk.h>
3 #include "opengl.h"
4 #include "part.h"
5 #include "game_part.h"
6 #include "menu_part.h"
8 static int width, height;
11 MainMenu::~MainMenu() {}
13 void MainMenu::draw() const
14 {
15 glClear(GL_COLOR_BUFFER_BIT);
17 imtk_begin();
19 imtk_layout_start(width / 2, height / 2);
20 imtk_layout_dir(IMTK_VERTICAL);
21 imtk_layout_spacing(10);
23 if(imtk_button(IMUID, "Play", IMTK_AUTO, IMTK_AUTO)) {
24 cur_part = game_part;
25 }
26 if(imtk_button(IMUID, "Quit", IMTK_AUTO, IMTK_AUTO)) {
27 exit(0);
28 }
30 imtk_end();
31 }
33 void MainMenu::reshape(int x, int y)
34 {
35 imtk_set_viewport(x, y);
36 width = x;
37 height = y;
38 }
40 void MainMenu::mouse_button(int bn, bool pressed)
41 {
42 imtk_inp_mouse(bn, pressed ? 1 : 0);
43 }
45 void MainMenu::mouse_motion(int x, int y)
46 {
47 imtk_inp_motion(x, y);
48 }