mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
curses app tweaks (smaller scoreboard)
This commit is contained in:
parent
cdcf63a0bf
commit
edec1c01fd
2 changed files with 25 additions and 11 deletions
|
@ -550,6 +550,7 @@ setupBoard( CursesBoardGlobals* bGlobals )
|
|||
XP_FALSE, &dims );
|
||||
board_applyLayout( board, &dims );
|
||||
XP_LOGF( "%s(): calling board_draw()", __func__ );
|
||||
board_invalAll( board );
|
||||
board_draw( board );
|
||||
}
|
||||
|
||||
|
|
|
@ -131,8 +131,14 @@ static void
|
|||
formatRemText( XP_S16 nTilesLeft, const XP_Rect* rect, char* buf, char** lines )
|
||||
{
|
||||
if ( 1 == rect->height ) {
|
||||
const char* fmt;
|
||||
if ( rect->width < 15 ) {
|
||||
fmt = "%d";
|
||||
} else {
|
||||
fmt = "Rem: %.3d";
|
||||
}
|
||||
*lines = buf;
|
||||
sprintf( buf, "Rem: %.3d", nTilesLeft );
|
||||
sprintf( buf, fmt, nTilesLeft );
|
||||
} else {
|
||||
sprintf( buf, "Rem:" );
|
||||
*lines++ = buf;
|
||||
|
@ -148,17 +154,20 @@ curses_draw_measureRemText( DrawCtx* XP_UNUSED(dctx),
|
|||
XP_S16 nTilesLeft,
|
||||
XP_U16* width, XP_U16* height )
|
||||
{
|
||||
char buf[64];
|
||||
char* lines[2] = {0};
|
||||
formatRemText( nTilesLeft, rect, buf, lines );
|
||||
if ( 0 == nTilesLeft ) {
|
||||
*width = *height = 0;
|
||||
} else {
|
||||
char buf[64];
|
||||
char* lines[2] = {0};
|
||||
formatRemText( nTilesLeft, rect, buf, lines );
|
||||
|
||||
*width = 0;
|
||||
int ii;
|
||||
for ( ii = 0; ii < VSIZE(lines) && !!lines[ii]; ++ii ) {
|
||||
*width = XP_MAX( *width, strlen(lines[ii]) );
|
||||
*width = 0;
|
||||
int ii;
|
||||
for ( ii = 0; ii < VSIZE(lines) && !!lines[ii]; ++ii ) {
|
||||
*width = XP_MAX( *width, strlen(lines[ii]) );
|
||||
}
|
||||
*height = ii;
|
||||
}
|
||||
*height = ii;
|
||||
|
||||
return XP_TRUE;
|
||||
} /* curses_draw_measureRemText */
|
||||
|
||||
|
@ -222,7 +231,11 @@ formatScoreText( XP_UCHAR* out, const DrawScoreInfo* dsi, const XP_Rect* rect,
|
|||
out += 4;
|
||||
}
|
||||
|
||||
sprintf( out, "%.3d", dsi->totalScore );
|
||||
if ( 1 == rect->height ) {
|
||||
sprintf( out, "%c:%.3d", dsi->name[0], dsi->totalScore );
|
||||
} else {
|
||||
sprintf( out, "%.3d", dsi->totalScore );
|
||||
}
|
||||
*lines++ = out;
|
||||
out += 1 + strlen(out);
|
||||
|
||||
|
|
Loading…
Reference in a new issue