stratgame
view 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 |
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 }