X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=freeglut-1.3%2Ffreeglut_menu.c;h=921deecd33c0546420b921059e808c94fd7f3ab4;hb=60fc701ac5ebd652058a209dac1486d4c5089662;hp=c50cea5e14c05d1ab3312ab73237b43bda7e31ab;hpb=a82e219413778d1fd55d270af98e9ad6a97e25a0;p=freeglut diff --git a/freeglut-1.3/freeglut_menu.c b/freeglut-1.3/freeglut_menu.c index c50cea5..921deec 100644 --- a/freeglut-1.3/freeglut_menu.c +++ b/freeglut-1.3/freeglut_menu.c @@ -32,7 +32,7 @@ #define G_LOG_DOMAIN "freeglut-menu" #include "../include/GL/freeglut.h" -#include "../include/GL/freeglut_internal.h" +#include "freeglut_internal.h" /* * TODO BEFORE THE STABLE RELEASE: @@ -204,20 +204,20 @@ static void fghDisplayMenuBox( SFG_Menu* menu ) * Have the menu box drawn first. The +- values are * here just to make it more nice-looking... */ - glColor4f( 0.0, 0.0, 0.0, 1.0 ); + glColor4f( 0.0f, 0.0f, 0.0f, 1.0f ); glBegin( GL_QUADS ); - glVertex2f( menu->X , menu->Y - 1 ); - glVertex2f( menu->X + menu->Width, menu->Y - 1 ); - glVertex2f( menu->X + menu->Width, menu->Y + 4 + menu->Height ); - glVertex2f( menu->X , menu->Y + 4 + menu->Height ); + glVertex2i( menu->X , menu->Y - 1 ); + glVertex2i( menu->X + menu->Width, menu->Y - 1 ); + glVertex2i( menu->X + menu->Width, menu->Y + 4 + menu->Height ); + glVertex2i( menu->X , menu->Y + 4 + menu->Height ); glEnd(); - glColor4f( 0.3, 0.4, 0.5, 1.0 ); + glColor4f( 0.3f, 0.4f, 0.5f, 1.0f ); glBegin( GL_QUADS ); - glVertex2f( menu->X - 2 , menu->Y + 1 ); - glVertex2f( menu->X - 2 + menu->Width, menu->Y + 1 ); - glVertex2f( menu->X - 2 + menu->Width, menu->Y + 2 + menu->Height ); - glVertex2f( menu->X - 2 , menu->Y + 2 + menu->Height ); + glVertex2i( menu->X - 2 , menu->Y + 1 ); + glVertex2i( menu->X - 2 + menu->Width, menu->Y + 1 ); + glVertex2i( menu->X - 2 + menu->Width, menu->Y + 2 + menu->Height ); + glVertex2i( menu->X - 2 , menu->Y + 2 + menu->Height ); glEnd(); /* @@ -241,12 +241,12 @@ static void fghDisplayMenuBox( SFG_Menu* menu ) /* * So have the highlight drawn... */ - glColor4f( 0.2, 0.3, 0.4, 1.0 ); + glColor4f( 0.2f, 0.3f, 0.4f, 1.0f ); glBegin( GL_QUADS ); - glVertex2f( menu->X - 2 , menu->Y + (menuID + 0)*FREEGLUT_MENU_HEIGHT + 1 ); - glVertex2f( menu->X - 2 + menu->Width, menu->Y + (menuID + 0)*FREEGLUT_MENU_HEIGHT + 1 ); - glVertex2f( menu->X - 2 + menu->Width, menu->Y + (menuID + 1)*FREEGLUT_MENU_HEIGHT + 2 ); - glVertex2f( menu->X - 2 , menu->Y + (menuID + 1)*FREEGLUT_MENU_HEIGHT + 2 ); + glVertex2i( menu->X - 2 , menu->Y + (menuID + 0)*FREEGLUT_MENU_HEIGHT + 1 ); + glVertex2i( menu->X - 2 + menu->Width, menu->Y + (menuID + 0)*FREEGLUT_MENU_HEIGHT + 1 ); + glVertex2i( menu->X - 2 + menu->Width, menu->Y + (menuID + 1)*FREEGLUT_MENU_HEIGHT + 2 ); + glVertex2i( menu->X - 2 , menu->Y + (menuID + 1)*FREEGLUT_MENU_HEIGHT + 2 ); glEnd(); } } @@ -420,7 +420,7 @@ void fgActivateMenu( SFG_Window* window, int button ) menu->X = x ; menu->Y = y ; - glutSetWindow ( window->ID ) ; + fgSetWindow ( window ) ; if( x > ( glutGet( GLUT_WINDOW_WIDTH ) - menu->Width ) ) menu->X = glutGet( GLUT_WINDOW_WIDTH ) - menu->Width; @@ -665,7 +665,7 @@ void FGAPIENTRY glutAddSubMenu( const char* label, int subMenuID ) /* * Fill in the appropriate values */ - menuEntry->Text = strdup( label ); + menuEntry->Text = strdup( label ); menuEntry->SubMenu = subMenu; menuEntry->ID = -1; @@ -708,7 +708,7 @@ void FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value ) if( menuEntry->Text != NULL ) free( menuEntry->Text ); - menuEntry->Text = strdup( label ); + menuEntry->Text = strdup( label ); menuEntry->ID = value; menuEntry->SubMenu = NULL; @@ -748,7 +748,7 @@ void FGAPIENTRY glutChangeToSubMenu( int item, const char* label, int subMenuID if( menuEntry->Text != NULL ) free( menuEntry->Text ); - menuEntry->Text = strdup( label ); + menuEntry->Text = strdup( label ); menuEntry->SubMenu = subMenu; menuEntry->ID = -1; @@ -844,4 +844,17 @@ void FGAPIENTRY glutDetachMenu( int button ) fgStructure.Window->Menu[ button ] = NULL; } +/* + * A.Donev: Set and retrieve the menu's user data + */ +void* FGAPIENTRY glutGetMenuData( void ) +{ + return(fgStructure.Menu->UserData); +} + +void FGAPIENTRY glutSetMenuData(void* data) +{ + fgStructure.Menu->UserData=data; +} + /*** END OF FILE ***/