mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +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 );
|
XP_FALSE, &dims );
|
||||||
board_applyLayout( board, &dims );
|
board_applyLayout( board, &dims );
|
||||||
XP_LOGF( "%s(): calling board_draw()", __func__ );
|
XP_LOGF( "%s(): calling board_draw()", __func__ );
|
||||||
|
board_invalAll( board );
|
||||||
board_draw( board );
|
board_draw( board );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,8 +131,14 @@ static void
|
||||||
formatRemText( XP_S16 nTilesLeft, const XP_Rect* rect, char* buf, char** lines )
|
formatRemText( XP_S16 nTilesLeft, const XP_Rect* rect, char* buf, char** lines )
|
||||||
{
|
{
|
||||||
if ( 1 == rect->height ) {
|
if ( 1 == rect->height ) {
|
||||||
|
const char* fmt;
|
||||||
|
if ( rect->width < 15 ) {
|
||||||
|
fmt = "%d";
|
||||||
|
} else {
|
||||||
|
fmt = "Rem: %.3d";
|
||||||
|
}
|
||||||
*lines = buf;
|
*lines = buf;
|
||||||
sprintf( buf, "Rem: %.3d", nTilesLeft );
|
sprintf( buf, fmt, nTilesLeft );
|
||||||
} else {
|
} else {
|
||||||
sprintf( buf, "Rem:" );
|
sprintf( buf, "Rem:" );
|
||||||
*lines++ = buf;
|
*lines++ = buf;
|
||||||
|
@ -148,17 +154,20 @@ curses_draw_measureRemText( DrawCtx* XP_UNUSED(dctx),
|
||||||
XP_S16 nTilesLeft,
|
XP_S16 nTilesLeft,
|
||||||
XP_U16* width, XP_U16* height )
|
XP_U16* width, XP_U16* height )
|
||||||
{
|
{
|
||||||
char buf[64];
|
if ( 0 == nTilesLeft ) {
|
||||||
char* lines[2] = {0};
|
*width = *height = 0;
|
||||||
formatRemText( nTilesLeft, rect, buf, lines );
|
} else {
|
||||||
|
char buf[64];
|
||||||
|
char* lines[2] = {0};
|
||||||
|
formatRemText( nTilesLeft, rect, buf, lines );
|
||||||
|
|
||||||
*width = 0;
|
*width = 0;
|
||||||
int ii;
|
int ii;
|
||||||
for ( ii = 0; ii < VSIZE(lines) && !!lines[ii]; ++ii ) {
|
for ( ii = 0; ii < VSIZE(lines) && !!lines[ii]; ++ii ) {
|
||||||
*width = XP_MAX( *width, strlen(lines[ii]) );
|
*width = XP_MAX( *width, strlen(lines[ii]) );
|
||||||
|
}
|
||||||
|
*height = ii;
|
||||||
}
|
}
|
||||||
*height = ii;
|
|
||||||
|
|
||||||
return XP_TRUE;
|
return XP_TRUE;
|
||||||
} /* curses_draw_measureRemText */
|
} /* curses_draw_measureRemText */
|
||||||
|
|
||||||
|
@ -222,7 +231,11 @@ formatScoreText( XP_UCHAR* out, const DrawScoreInfo* dsi, const XP_Rect* rect,
|
||||||
out += 4;
|
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;
|
*lines++ = out;
|
||||||
out += 1 + strlen(out);
|
out += 1 + strlen(out);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue