summaryrefslogtreecommitdiffstats
path: root/menu_demo/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'menu_demo/menu.c')
-rw-r--r--menu_demo/menu.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/menu_demo/menu.c b/menu_demo/menu.c
index ce1a998..e6a15ee 100644
--- a/menu_demo/menu.c
+++ b/menu_demo/menu.c
@@ -9,6 +9,7 @@
#include "menu.h"
#include "button.h"
+#include "font.h"
#define MENU_MAX_BUTTONS 16
@@ -56,8 +57,9 @@ void MenuInit(int f_iWinWidth, int f_iWinHeight)
// init main menu
g_sMenuMain.m_eMenuId = MENU_MAIN;
- MenuAddButton(50, 50, 200, 100, "Start", BUTTON_CLICK);
- MenuAddButton(300, 50, 200, 200, "Start", BUTTON_RADIO);
+ MenuAddButton(32, 16, 256, 128, "Button 1", BUTTON_CLICK);
+ MenuAddButton(32, 128, 256, 128, "Button 2", BUTTON_CLICK);
+ MenuAddButton(312, 16, 110, 110, "Radio 1", BUTTON_RADIO);
// init start menu
g_sMenuStart.m_eMenuId = MENU_START;
@@ -70,6 +72,9 @@ void MenuInit(int f_iWinWidth, int f_iWinHeight)
// set pointer to the current menu
g_pCurMenu = &g_sMenuMain;
+ // init font
+ FontInit(f_iWinWidth, f_iWinHeight);
+
} // MenuInit
@@ -87,14 +92,23 @@ void MenuRender(void)
glPushMatrix();
glLoadIdentity();
- glOrtho(1, (GLfloat)g_iWinWidth, (GLfloat)g_iWinHeight, 0, 0, 1);
+ glOrtho(0, g_iWinWidth, g_iWinHeight, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glEnable(GL_BLEND);
- //glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ //glBlendFunc(GL_ONE, GL_ZERO);
+
+ //glColor4d(0.25, 0.5, 1, 0.1);
+ //glBegin(GL_TRIANGLE_STRIP);
+ // glVertex2i(0, 0);
+ // glVertex2i(g_iWinWidth, 0);
+ // glVertex2i(0, g_iWinHeight);
+ // glVertex2i(g_iWinWidth, g_iWinHeight);
+ //glEnd();
+
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- // render the buttons (mask) on the current menu
+ // render the buttons of the current menu
i = 0;
while (i < g_pCurMenu->m_iButtonCount)
{
@@ -108,7 +122,6 @@ void MenuRender(void)
glMatrixMode(GL_PROJECTION);
glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
} // MenuRender