summaryrefslogtreecommitdiffstats
path: root/menu_demo/menu.c
blob: d1db8f8029cce5add7c37e6f4b3620dc46e2c358 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifdef G_OS_WIN32
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif

#include <GL/gl.h>

#include "button.h"

enum MenuState {
  MENU_MAIN,
  MENU_START,
  MENU_OPTIONS
};

struct MenuStruct {
  struct ButtonStruct button[10];
};

int g_iState; // which menu are we in

struct MenuStruct g_sMenuMain;    // definition of the main menu
struct MenuStruct g_sMenuStart;   // definition of the start menu
struct MenuStruct g_sMenuOptions; // definition of the options menu

void MenuMainRender(void)
{
  glBegin(GL_QUADS);
    glVertex3d( 10,  10, 0);
    glVertex3d( 10, -10, 0);
    glVertex3d(-10, -10, 0);
    glVertex3d(-10,  10, 0);
  glEnd();

} // MenuMainRender


void MenuOptionsRender(void)
{
} // MenuMainRender


void MenuSelectionRender(void)
{
} // MenuMainRender


void MenuInit(void)
{
  g_iState = MENU_MAIN;

} // InitMenu

int MenuGetState(void)
{
  return g_iState;

} // GetMenuState

void MenuRender(void)
{
  glColor3d(1, 1, 1);

  switch (g_iState)
  {
    case MENU_MAIN:
      MenuMainRender();
      break;

    case MENU_START:
      MenuOptionsRender();
      break;

    case MENU_OPTIONS:
      MenuSelectionRender();
      break;

  }

} // Render