From c0b901e9f82d4a266412fe86bacf5432fb49fd4e Mon Sep 17 00:00:00 2001 From: Oliver Schinagl Date: Wed, 14 May 2008 13:58:46 +0000 Subject: code cleanup --- matchblox/main.cpp | 1 + matchblox/menu/menu.c | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/matchblox/main.cpp b/matchblox/main.cpp index a7cbedb..32dbd27 100644 --- a/matchblox/main.cpp +++ b/matchblox/main.cpp @@ -139,6 +139,7 @@ int main(int argc, char **argv) glutSpecialFunc(process_special_keys); glutMouseFunc(process_mouse); glutPassiveMotionFunc(process_passive_mouse); + glutSetCursor(GLUT_CURSOR_NONE); init_gl(); MenuInit(SCREEN_WIDTH, SCREEN_HEIGHT); diff --git a/matchblox/menu/menu.c b/matchblox/menu/menu.c index 9687a2d..c92c2b8 100644 --- a/matchblox/menu/menu.c +++ b/matchblox/menu/menu.c @@ -74,12 +74,16 @@ void MenuAddButton(int f_dXPos, int f_dYPos, int f_dWidth, int f_dHeight, char * { int i = g_pCurMenu->m_iButtonCount; - if (i > MENU_MAX_BUTTONS - 1) return; - - // create the button with the right parameters - g_pCurMenu->m_sButtons[i] = ButtonCreate(f_dXPos, f_dYPos, f_dWidth, f_dHeight, f_pcTitle, f_iType, f_iGroup, i); - g_pCurMenu->m_iButtonCount = i + 1; - + if (i > MENU_MAX_BUTTONS - 1) + { + // return + } + else + { + // create the button with the right parameters + g_pCurMenu->m_sButtons[i] = ButtonCreate(f_dXPos, f_dYPos, f_dWidth, f_dHeight, f_pcTitle, f_iType, f_iGroup, i); + g_pCurMenu->m_iButtonCount = i + 1; + } } // MenuAddButton @@ -211,12 +215,12 @@ void MenuRender(void) { glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); - glColor3d(0.6, 0.6, 0.7); - glBegin(GL_TRIANGLE_STRIP); + glColor3f(0.6, 0.6, 0.7); + glBegin(GL_QUADS); glVertex2i(0, 0); - glVertex2i(g_iWinWidth, 0); glVertex2i(0, g_iWinHeight); glVertex2i(g_iWinWidth, g_iWinHeight); + glVertex2i(g_iWinWidth, 0); glEnd(); } @@ -230,7 +234,7 @@ void MenuRender(void) } // render cursor - glColor3d(1, 1, 1); + glColor4d(1, 1, 1, 1); BitmapRender(g_iXPos, g_iYPos, 64, //g_sCursorImage.m_iWidth, -- cgit v0.12