adding glutStrokeWidthf and glutStrokeLengthf from GLUT 3.8
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1718 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
9af2382e14
commit
3b634a941a
@ -202,7 +202,7 @@ FGAPI GLUTproc FGAPIENTRY glutGetProcAddress( const char *procName );
|
||||
|
||||
#define GLUT_HAS_MULTI 1
|
||||
|
||||
/* TODO: add device_id paramater,
|
||||
/* TODO: add device_id parameter,
|
||||
cf. http://sourceforge.net/mailarchive/forum.php?thread_name=20120518071314.GA28061%40perso.beuc.net&forum_name=freeglut-developer */
|
||||
FGAPI void FGAPIENTRY glutMultiEntryFunc( void (* callback)( int, int ) );
|
||||
FGAPI void FGAPIENTRY glutMultiButtonFunc( void (* callback)( int, int, int, int, int ) );
|
||||
|
@ -529,8 +529,10 @@ FGAPI void FGAPIENTRY glutBitmapCharacter( void* font, int character );
|
||||
FGAPI int FGAPIENTRY glutBitmapWidth( void* font, int character );
|
||||
FGAPI void FGAPIENTRY glutStrokeCharacter( void* font, int character );
|
||||
FGAPI int FGAPIENTRY glutStrokeWidth( void* font, int character );
|
||||
FGAPI GLfloat FGAPIENTRY glutStrokeWidthf( void* font, int character ); /* GLUT 3.8 */
|
||||
FGAPI int FGAPIENTRY glutBitmapLength( void* font, const unsigned char* string );
|
||||
FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* string );
|
||||
FGAPI GLfloat FGAPIENTRY glutStrokeLengthf( void* font, const unsigned char *string ); /* GLUT 3.8 */
|
||||
|
||||
/*
|
||||
* Geometry functions, see fg_geometry.c
|
||||
|
@ -125,8 +125,10 @@ static GLUTproc fghGetGLUTProcAddress( const char* procName )
|
||||
CHECK_NAME(glutBitmapWidth);
|
||||
CHECK_NAME(glutStrokeCharacter);
|
||||
CHECK_NAME(glutStrokeWidth);
|
||||
CHECK_NAME(glutStrokeWidthf);
|
||||
CHECK_NAME(glutBitmapLength);
|
||||
CHECK_NAME(glutStrokeLength);
|
||||
CHECK_NAME(glutStrokeLengthf);
|
||||
CHECK_NAME(glutWireSphere);
|
||||
CHECK_NAME(glutSolidSphere);
|
||||
CHECK_NAME(glutWireCone);
|
||||
|
@ -346,7 +346,7 @@ void FGAPIENTRY glutStrokeString( void* fontID, const unsigned char *string )
|
||||
/*
|
||||
* Return the width in pixels of a stroke character
|
||||
*/
|
||||
int FGAPIENTRY glutStrokeWidth( void* fontID, int character )
|
||||
GLfloat FGAPIENTRY glutStrokeWidthf( void* fontID, int character )
|
||||
{
|
||||
const SFG_StrokeChar *schar;
|
||||
SFG_StrokeFont* font;
|
||||
@ -364,17 +364,21 @@ int FGAPIENTRY glutStrokeWidth( void* fontID, int character )
|
||||
schar = font->Characters[ character ];
|
||||
freeglut_return_val_if_fail( schar, 0 );
|
||||
|
||||
return ( int )( schar->Right + 0.5 );
|
||||
return schar->Right;
|
||||
}
|
||||
int FGAPIENTRY glutStrokeWidth(void* fontID, int character)
|
||||
{
|
||||
return ( int )( glutStrokeWidthf(fontID,character) + 0.5f );
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the width of a string drawn using a stroke font
|
||||
*/
|
||||
int FGAPIENTRY glutStrokeLength( void* fontID, const unsigned char* string )
|
||||
GLfloat FGAPIENTRY glutStrokeLengthf( void* fontID, const unsigned char* string )
|
||||
{
|
||||
unsigned char c;
|
||||
float length = 0.0;
|
||||
float this_line_length = 0.0;
|
||||
GLfloat length = 0.0;
|
||||
GLfloat this_line_length = 0.0;
|
||||
SFG_StrokeFont* font;
|
||||
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutStrokeLength" );
|
||||
font = fghStrokeByID( fontID );
|
||||
@ -404,7 +408,11 @@ int FGAPIENTRY glutStrokeLength( void* fontID, const unsigned char* string )
|
||||
}
|
||||
if( length < this_line_length )
|
||||
length = this_line_length;
|
||||
return( int )( length + 0.5 );
|
||||
return length;
|
||||
}
|
||||
int FGAPIENTRY glutStrokeLength( void* fontID, const unsigned char* string )
|
||||
{
|
||||
return( int )( glutStrokeLengthf(fontID,string) + 0.5f );
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user