#define GLUT_GEOMETRY_VISUALIZE_NORMALS 0x0205
-#define GLUT_MENU_FONT 0x0206 /* TOOD: now glutSetOption only */
-
/*
* New tokens for glutInitDisplayMode.
* Only one GLUT_AUXn bit may be used at a time.
/*
* Menu functions
*/
-FGAPI void FGAPIENTRY glutSetMenuFont( void* font );
+FGAPI void FGAPIENTRY glutSetMenuFont( int menuID, void* font );
/*
* Window-specific callback functions, see freeglut_callbacks.c
* what we demonstrate here.
*/
glutSetKeyRepeat(GLUT_KEY_REPEAT_ON);
- /* global setting: default font for any menus created after this call (we call it again below to demo) */
- glutSetOption(GLUT_MENU_FONT,(int)GLUT_BITMAP_HELVETICA_12);
/* Set other global callback (global as in not associated with any specific menu or window) */
glutIdleFunc ( Idle );
glutAddMenuEntry( "Sub menu A2 (02)", 12 );
glutAddMenuEntry( "Sub menu A3 (03)", 13 );
glutMenuDestroyFunc ( MenuDestroy ); /* callback specific to this menu */
-
- /* change font for any menus created after this call */
- glutSetOption(GLUT_MENU_FONT,(int)GLUT_BITMAP_8_BY_13);
+ /* Change font for this menu */
+ glutSetMenuFont(subMenuA, GLUT_BITMAP_HELVETICA_12);
subMenuB = glutCreateMenu( MenuCallback );
glutAddMenuEntry( "Sub menu B1 (04)", 14 );
glutAddMenuEntry( "Sub menu B3 (06)", 16 );
glutAddSubMenu( "Going to sub menu A", subMenuA );
glutMenuDestroyFunc ( MenuDestroy ); /* callback specific to this menu */
+ glutSetMenuFont(subMenuB, GLUT_BITMAP_9_BY_15);
menuID = glutCreateMenu( MenuCallback );
glutAddMenuEntry( "Entry one", 21 );
glutMenuDestroyFunc ( MenuDestroy ); /* callback specific to this menu */
glutAttachMenu( GLUT_LEFT_BUTTON );
- /* You can also change the font of the current menu: */
- glutSetMenuFont(GLUT_BITMAP_TIMES_ROMAN_10);
/* Position second window right next to the first */
/*
* Changes the current menu's font
*/
-void FGAPIENTRY glutSetMenuFont( void* fontID )
+void FGAPIENTRY glutSetMenuFont( int menuID, void* fontID )
{
SFG_Font* font;
+ SFG_Menu* menu;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetMenuFont" );
- freeglut_return_if_fail( fgStructure.CurrentMenu );
+ menu = fgMenuByID( menuID );
+ freeglut_return_if_fail( menu );
if (fgGetActiveMenu())
fgError("Menu manipulation not allowed while menus in use.");
font = fghFontByID( fontID );
if (!font)
+ {
fgWarning("glutChangeMenuFont: bitmap font 0x%08x not found. Make sure you're not passing a stroke font. Ignoring...\n",fontID);
- freeglut_return_if_fail( font );
+ return;
+ }
fgStructure.CurrentMenu->Font = fontID;
fghCalculateMenuBoxSize( );
fgStructure.CurrentWindow->State.VisualizeNormals = value;
break;
- case GLUT_MENU_FONT:
- {
- void* fontID = (void*)value;
- SFG_Font* font;
- font = fghFontByID( fontID );
- if (!font)
- fgWarning("glutSetOption(GLUT_MENU_FONT,...): bitmap font 0x%08x not found. Make sure you're not passing a stroke font. Ignoring...\n",fontID);
- else
- fgState.MenuFont = fontID;
- }
- break;
-
default:
fgWarning( "glutSetOption(): missing enum handle %d", eWhat );
break;