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.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/menu_demo/button.c b/menu_demo/button.c
index cafa94a..7df7b08 100644
--- a/menu_demo/button.c
+++ b/menu_demo/button.c
@@ -1,6 +1,6 @@
#ifdef G_OS_WIN32
-#define WIN32_LEAN_AND_MEAN 1
-#include <windows.h>
+ #define WIN32_LEAN_AND_MEAN 1
+ #include <windows.h>
#endif
#include <GL/gl.h>
@@ -8,13 +8,7 @@
#include "button.h"
#include "bitmap.h"
-#define BUTTON_CLICK_HEIGHT 50
-
-enum ButtonType {
- BUTTON_CLICK,
- BUTTON_RADIO,
- BUTTON_LABEL
-};
+#define BUTTON_CLICK_HEIGHT 49
void ButtonClickRender(struct ButtonStruct *f_sButton)
{
@@ -28,13 +22,36 @@ void ButtonClickRender(struct ButtonStruct *f_sButton)
memset(&l_pcTitle, 0, sizeof(l_pcTitle));
memcpy(&l_pcTitle, f_sButton->m_pcTitle, sizeof(f_sButton->m_pcTitle));
+ BitmapLoad("img/button_click_left.bmp");
+
+ glBegin(GL_QUADS);
+ glTexCoord3d(0, 1, 0); glVertex3d(l_dXPos, l_dYPos, 0);
+ glTexCoord3d(1, 1, 0); glVertex3d(l_dXPos + 26, l_dYPos, 0);
+ glTexCoord3d(1, 0, 0); glVertex3d(l_dXPos + 26, l_dYPos - BUTTON_CLICK_HEIGHT, 0);
+ glTexCoord3d(0, 0, 0); glVertex3d(l_dXPos, l_dYPos - BUTTON_CLICK_HEIGHT, 0);
+ glEnd();
+
+ BitmapLoad("img/button_click_right.bmp");
+
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);
+ glTexCoord3d(0, 1, 0); glVertex3d(l_dXPos + 24 + l_dWidth, l_dYPos, 0);
+ glTexCoord3d(1, 1, 0); glVertex3d(l_dXPos + 24 + l_dWidth + 25, l_dYPos, 0);
+ glTexCoord3d(1, 0, 0); glVertex3d(l_dXPos + 24 + l_dWidth + 25, l_dYPos - BUTTON_CLICK_HEIGHT, 0);
+ glTexCoord3d(0, 0, 0); glVertex3d(l_dXPos + 24 + l_dWidth, l_dYPos - BUTTON_CLICK_HEIGHT, 0);
glEnd();
+ if (l_dWidth > 0)
+ {
+ BitmapLoad("img/button_click_center.bmp");
+
+ glBegin(GL_QUADS);
+ glTexCoord3d(0, 1, 0); glVertex3d(l_dXPos + 25, l_dYPos, 0);
+ glTexCoord3d(1, 1, 0); glVertex3d(l_dXPos + 25 + l_dWidth, l_dYPos, 0);
+ glTexCoord3d(1, 0, 0); glVertex3d(l_dXPos + 25 + l_dWidth, l_dYPos - BUTTON_CLICK_HEIGHT, 0);
+ glTexCoord3d(0, 0, 0); glVertex3d(l_dXPos + 25, l_dYPos - BUTTON_CLICK_HEIGHT, 0);
+ glEnd();
+ }
+
} // ButtonClickRender
void ButtonRender(struct ButtonStruct *f_sButton)