Modified the menus to refer to {border} rather than {FREEGLUT_MENU_BORDER},

in fghDisplayMenuBox().  The local variable was already defined and used
for some purposes, so we might as well use it throughout.  It does serve
to shorten and clarify the code a bit---though I have mixed feelings about
creating aliases that way.

Still, the variable already existed and was already used in places.  (We
could even move it into the freeglut state, or make it a {const static}
value...)

Oh well.  Stuff to ponder.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@328 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
rkrolib 2003-11-10 01:21:06 +00:00
parent fb26d91989
commit 6230b2de2a

View File

@ -273,30 +273,30 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
glBegin( GL_QUAD_STRIP ); glBegin( GL_QUAD_STRIP );
glVertex2i( menu->Width , 0 ); glVertex2i( menu->Width , 0 );
glVertex2i( menu->Width-border, border); glVertex2i( menu->Width - border, border);
glVertex2i( 0 , 0 ); glVertex2i( 0 , 0 );
glVertex2i( border, border); glVertex2i( border, border);
glVertex2i( 0 , menu->Height ); glVertex2i( 0 , menu->Height );
glVertex2i( border, menu->Height-border); glVertex2i( border, menu->Height - border);
glEnd( ); glEnd( );
/* a non-black dark version of the below. */ /* a non-black dark version of the below. */
glColor4f( 0.5f, 0.5f, 0.5f, 1.0f ); glColor4f( 0.5f, 0.5f, 0.5f, 1.0f );
glBegin( GL_QUAD_STRIP ); glBegin( GL_QUAD_STRIP );
glVertex2i( 0 , menu->Height ); glVertex2i( 0 , menu->Height );
glVertex2i( border, menu->Height-border); glVertex2i( border, menu->Height - border);
glVertex2i( menu->Width , menu->Height ); glVertex2i( menu->Width , menu->Height );
glVertex2i( menu->Width-border, menu->Height-border); glVertex2i( menu->Width - border, menu->Height - border);
glVertex2i( menu->Width , 0 ); glVertex2i( menu->Width , 0 );
glVertex2i( menu->Width-border, border); glVertex2i( menu->Width - border, border);
glEnd( ); glEnd( );
glColor4fv( menu_pen_back ) ; glColor4fv( menu_pen_back ) ;
glBegin( GL_QUADS ); glBegin( GL_QUADS );
glVertex2i( border, border); glVertex2i( border, border);
glVertex2i( menu->Width-border, border); glVertex2i( menu->Width - border, border);
glVertex2i( menu->Width-border, menu->Height-border); glVertex2i( menu->Width - border, menu->Height - border);
glVertex2i( border, menu->Height-border); glVertex2i( border, menu->Height - border);
glEnd( ); glEnd( );
/* /*
@ -323,18 +323,14 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
*/ */
glColor4fv( menu_pen_hback ); glColor4fv( menu_pen_hback );
glBegin( GL_QUADS ); glBegin( GL_QUADS );
glVertex2i( FREEGLUT_MENU_BORDER, glVertex2i( border,
(menuID + 0)*FREEGLUT_MENU_HEIGHT + (menuID + 0)*FREEGLUT_MENU_HEIGHT + border );
FREEGLUT_MENU_BORDER ); glVertex2i( menu->Width - border,
glVertex2i( menu->Width-FREEGLUT_MENU_BORDER, (menuID + 0)*FREEGLUT_MENU_HEIGHT + border );
(menuID + 0)*FREEGLUT_MENU_HEIGHT + glVertex2i( menu->Width - border,
FREEGLUT_MENU_BORDER ); (menuID + 1)*FREEGLUT_MENU_HEIGHT + border );
glVertex2i( menu->Width-FREEGLUT_MENU_BORDER, glVertex2i( border,
(menuID + 1)*FREEGLUT_MENU_HEIGHT + (menuID + 1)*FREEGLUT_MENU_HEIGHT + border );
FREEGLUT_MENU_BORDER );
glVertex2i( FREEGLUT_MENU_BORDER,
(menuID + 1)*FREEGLUT_MENU_HEIGHT +
FREEGLUT_MENU_BORDER );
glEnd( ); glEnd( );
} }
} }
@ -360,9 +356,9 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
*/ */
/* Try to center the text - JCJ 31 July 2003*/ /* Try to center the text - JCJ 31 July 2003*/
glRasterPos2i( glRasterPos2i(
2 * FREEGLUT_MENU_BORDER, 2 * border,
(i + 1)*FREEGLUT_MENU_HEIGHT-(int)( FREEGLUT_MENU_HEIGHT*0.3 - (i + 1)*FREEGLUT_MENU_HEIGHT -
FREEGLUT_MENU_BORDER ) (int)( FREEGLUT_MENU_HEIGHT*0.3 - border )
); );
/* /*
@ -377,14 +373,12 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
{ {
int width = glutBitmapWidth( FREEGLUT_MENU_FONT, '_' ); int width = glutBitmapWidth( FREEGLUT_MENU_FONT, '_' );
int x_base = menu->Width - 2 - width; int x_base = menu->Width - 2 - width;
int y_base = i*FREEGLUT_MENU_HEIGHT + FREEGLUT_MENU_BORDER; int y_base = i*FREEGLUT_MENU_HEIGHT + border;
glBegin( GL_TRIANGLES ); glBegin( GL_TRIANGLES );
glVertex2i( x_base, y_base + 2*FREEGLUT_MENU_BORDER); glVertex2i( x_base, y_base + 2 * border);
glVertex2i( menu->Width - 2, y_base + glVertex2i( menu->Width - 2, y_base +
( FREEGLUT_MENU_HEIGHT + ( FREEGLUT_MENU_HEIGHT + border) / 2 );
FREEGLUT_MENU_BORDER) / 2 ); glVertex2i( x_base, y_base + FREEGLUT_MENU_HEIGHT - border );
glVertex2i( x_base, y_base + FREEGLUT_MENU_HEIGHT -
FREEGLUT_MENU_BORDER);
glEnd( ); glEnd( );
} }