skip Pts string if doing highres without small font capability

This commit is contained in:
ehouse 2004-11-03 03:57:07 +00:00
parent e96013f4c9
commit 4b37b0dc94

View file

@ -445,6 +445,26 @@ palm_bnw_draw_trayFinished( DrawCtx* p_dctx )
WinSetClip( &dctx->oldTrayClip ); WinSetClip( &dctx->oldTrayClip );
} /* palm_draw_trayFinished */ } /* palm_draw_trayFinished */
#ifdef FEATURE_HIGHRES
static void
smallBoldStringAt( const char* str, XP_U16 len, XP_S16 x, XP_U16 y )
{
UInt32 oldMode = WinSetScalingMode( kTextScalingOff );
FontID curFont = FntGetFont();
FntSetFont( boldFont );
/* negative x means position backwards from it */
if ( x < 0 ) {
x = (-x) - FntCharsWidth( str, len );
}
WinDrawChars( str, len, x, y );
FntSetFont( curFont );
WinSetScalingMode( oldMode );
} /* smallBoldStringAt */
#endif
static void static void
palm_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect, palm_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect,
XP_UCHAR* letters, XP_Bitmap bitmap, XP_UCHAR* letters, XP_Bitmap bitmap,
@ -497,15 +517,9 @@ palm_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect,
if ( 0 ) { if ( 0 ) {
#ifdef FEATURE_HIGHRES #ifdef FEATURE_HIGHRES
} else if ( dctx->doHiRes && dctx->oneDotFiveAvail ) { } else if ( dctx->doHiRes && dctx->oneDotFiveAvail ) {
UInt32 oldMode = WinSetScalingMode( kTextScalingOff ); smallBoldStringAt( valBuf, len,
FontID curFont = FntGetFont(); -(localR.left + localR.width),
FntSetFont( boldFont );
width = FntCharsWidth( (const char*)valBuf, len );
WinDrawChars( valBuf, len,
localR.left + localR.width - width,
localR.top + localR.height - dctx->fntHeight - 1 ); localR.top + localR.height - dctx->fntHeight - 1 );
FntSetFont( curFont );
WinSetScalingMode( oldMode );
#endif #endif
} else { } else {
@ -924,7 +938,6 @@ palm_draw_score_pendingScore( DrawCtx* p_dctx, XP_Rect* rect, XP_S16 score,
XP_U16 playerNum ) XP_U16 playerNum )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
XP_UCHAR* str;
char buf[PENDING_DIGITS+1] = "000"; char buf[PENDING_DIGITS+1] = "000";
RectangleType oldClip, newClip; RectangleType oldClip, newClip;
XP_U16 x = rect->left + 1; XP_U16 x = rect->left + 1;
@ -951,11 +964,20 @@ palm_draw_score_pendingScore( DrawCtx* p_dctx, XP_Rect* rect, XP_S16 score,
StrCopy( buf, "???" ); StrCopy( buf, "???" );
} }
if ( rect->height >= PALM_TRAY_SCALEH ) { /* There's no room for the pts string if we're in highres mode and
str = (*dctx->getResStrFunc)( dctx->globals, STR_PTS ); WinSetScalingMode isn't available. */
if ( !dctx->doHiRes || dctx->oneDotFiveAvail ) {
XP_UCHAR* str = (*dctx->getResStrFunc)( dctx->globals, STR_PTS );
if ( dctx->oneDotFiveAvail ) {
smallBoldStringAt( (const char*)str, XP_STRLEN((const char*)str),
x, rect->top );
} else {
WinDrawChars( (const char*)str, WinDrawChars( (const char*)str,
XP_STRLEN((const char*)str), x, rect->top ); XP_STRLEN((const char*)str), x, rect->top );
} }
}
WinDrawChars( buf, PENDING_DIGITS, x, WinDrawChars( buf, PENDING_DIGITS, x,
rect->top + (rect->height/2) - 1 ); rect->top + (rect->height/2) - 1 );
WinSetClip( &oldClip ); WinSetClip( &oldClip );