diff options
author | Wilrik de Loose <wilrik@wilrik.nl> | 2008-04-16 15:04:46 (GMT) |
---|---|---|
committer | Wilrik de Loose <wilrik@wilrik.nl> | 2008-04-16 15:04:46 (GMT) |
commit | 7e5ef59c21af27e98f2a50b076d3b73882929768 (patch) | |
tree | 963750c591d26e4351accaebfadbfe07b58a3609 /menu_demo/button.c | |
parent | 3956e14034371e778e7457a344adc66d27f5fc0a (diff) | |
download | 2iv55-7e5ef59c21af27e98f2a50b076d3b73882929768.zip 2iv55-7e5ef59c21af27e98f2a50b076d3b73882929768.tar.gz 2iv55-7e5ef59c21af27e98f2a50b076d3b73882929768.tar.bz2 |
Buttons werkend. Nu nog radio buttons en dergelijke + font/bitmap lettertype toevoegen (en afhandeling van buttons uiteraars.
Diffstat (limited to 'menu_demo/button.c')
-rw-r--r-- | menu_demo/button.c | 43 |
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)
|