summaryrefslogtreecommitdiffstats
path: root/menu_demo/button.c
diff options
context:
space:
mode:
Diffstat (limited to 'menu_demo/button.c')
-rw-r--r--menu_demo/button.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/menu_demo/button.c b/menu_demo/button.c
index 499570b..2e98286 100644
--- a/menu_demo/button.c
+++ b/menu_demo/button.c
@@ -5,10 +5,39 @@
#include <GL/gl.h>
+#include "button.h"
#include "bitmap.h"
+#define BUTTON_CLICK_HEIGHT 50
+
enum ButtonType {
- MENU_MAIN,
- MENU_START,
- MENU_OPTIONS
+ BUTTON_CLICK,
+ BUTTON_RADIO,
+ BUTTON_LABEL
};
+
+void ButtonRender(struct ButtonStruct *f_sButton)
+{
+ char l_pcTitle[BUTTON_MAX_TITLE];
+
+ double l_dWidth = f_sButton->m_dWidth;
+ double l_dXPos = f_sButton->m_dXPos;
+ double l_dYPos = f_sButton->m_dYPos;
+ int l_iType = f_sButton->m_iType;
+
+ memset(&l_pcTitle, 0, sizeof(l_pcTitle));
+ memcpy(&l_pcTitle, f_sButton->m_pcTitle, sizeof(f_sButton->m_pcTitle));
+
+ switch (l_iType)
+ {
+ case BUTTON_CLICK:
+ glBegin(GL_QUADS);
+ glVertex3d(l_dXPos, l_dYPos, 0);
+ glVertex3d(l_dXPos + l_dWidth, l_dYPos, 0);
+ glVertex3d(l_dXPos + l_dWidth, l_dYPos - BUTTON_CLICK_HEIGHT, 0);
+ glVertex3d(l_dXPos, l_dYPos - BUTTON_CLICK_HEIGHT, 0);
+ glEnd();
+ break;
+ }
+
+} // ButtonRender