mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
show which tiles on board are blanks; use tile background for on-board tiles
This commit is contained in:
parent
9420dec8fb
commit
9f53816f8d
1 changed files with 41 additions and 21 deletions
|
@ -139,7 +139,7 @@ ce_draw_drawCell( DrawCtx* p_dctx, XP_Rect* xprect,
|
||||||
RECT rt;
|
RECT rt;
|
||||||
XP_U16 bkIndex;
|
XP_U16 bkIndex;
|
||||||
XP_UCHAR* cp = NULL;
|
XP_UCHAR* cp = NULL;
|
||||||
COLORREF foreIndex;
|
COLORREF foreColorRef;
|
||||||
|
|
||||||
XP_ASSERT( !!hdc );
|
XP_ASSERT( !!hdc );
|
||||||
|
|
||||||
|
@ -150,48 +150,68 @@ ce_draw_drawCell( DrawCtx* p_dctx, XP_Rect* xprect,
|
||||||
Rectangle( hdc, rt.left, rt.top, rt.right, rt.bottom );
|
Rectangle( hdc, rt.left, rt.top, rt.right, rt.bottom );
|
||||||
InsetRect( &rt, 1, 1 );
|
InsetRect( &rt, 1, 1 );
|
||||||
|
|
||||||
|
if ( (!!letters && letters[0] != '\0' ) || !!bitmap ) {
|
||||||
if ( isPending ) {
|
if ( isPending ) {
|
||||||
foreIndex = dctx->colors[WHITE_COLOR];
|
|
||||||
bkIndex = BLACK_COLOR;
|
bkIndex = BLACK_COLOR;
|
||||||
|
foreColorRef = dctx->colors[WHITE_COLOR];
|
||||||
} else {
|
} else {
|
||||||
foreIndex = dctx->colors[getPlayerColor(owner)];
|
foreColorRef = dctx->colors[getPlayerColor(owner)];
|
||||||
if ( bonus == BONUS_NONE ) {
|
bkIndex = TILEBACK_COLOR;
|
||||||
|
}
|
||||||
|
} else if ( bonus == BONUS_NONE ) {
|
||||||
bkIndex = BKG_COLOR;
|
bkIndex = BKG_COLOR;
|
||||||
} else {
|
} else {
|
||||||
bkIndex = bonus+BONUS1_COLOR;
|
bkIndex = (bonus - BONUS_DOUBLE_LETTER) + BONUS1_COLOR;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FillRect( hdc, &rt, dctx->brushes[bkIndex] );
|
FillRect( hdc, &rt, dctx->brushes[bkIndex] );
|
||||||
SetBkColor( hdc, dctx->colors[bkIndex] );
|
SetBkColor( hdc, dctx->colors[bkIndex] );
|
||||||
|
|
||||||
if ( !!letters && (letters[0] != '\0') ) {
|
if ( !!letters && (letters[0] != '\0') ) {
|
||||||
cp = letters;
|
|
||||||
} else if ( !!bitmap ) {
|
|
||||||
/* it's already NULL */
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !!cp ) {
|
|
||||||
wchar_t widebuf[4];
|
wchar_t widebuf[4];
|
||||||
|
cp = letters;
|
||||||
|
|
||||||
XP_MEMSET( widebuf, 0, sizeof(widebuf) );
|
XP_MEMSET( widebuf, 0, sizeof(widebuf) );
|
||||||
|
|
||||||
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, cp, -1,
|
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, cp, -1,
|
||||||
widebuf, sizeof(widebuf)/sizeof(widebuf[0]) );
|
widebuf, sizeof(widebuf)/sizeof(widebuf[0]) );
|
||||||
|
|
||||||
SetTextColor( hdc, foreIndex );
|
SetTextColor( hdc, foreColorRef );
|
||||||
DrawText( hdc, widebuf, -1, &rt,
|
DrawText( hdc, widebuf, -1, &rt,
|
||||||
DT_SINGLELINE | DT_VCENTER | DT_CENTER);
|
DT_SINGLELINE | DT_VCENTER | DT_CENTER);
|
||||||
} else if ( !!bitmap ) {
|
} else if ( !!bitmap ) {
|
||||||
makeAndDrawBitmap( dctx, hdc, rt.left + 2, rt.top + 3, foreIndex,
|
makeAndDrawBitmap( dctx, hdc, rt.left + 2, rt.top + 3, foreColorRef,
|
||||||
(CEBitmapInfo*)bitmap );
|
(CEBitmapInfo*)bitmap );
|
||||||
/* CEBitmapInfo* info = (CEBitmapInfo*)bitmap; */
|
|
||||||
/* HBITMAP bm = CreateBitmap( info->nCols, info->nRows, 1, 1, info->bits ); */
|
|
||||||
/* ceDrawBitmapInRect( hdc, rt.left+2, rt.top+2, bm ); */
|
|
||||||
/* DeleteObject( bm ); */
|
|
||||||
} else if ( isStar ) {
|
} else if ( isStar ) {
|
||||||
ceDrawBitmapInRect( hdc, rt.left+2, rt.top+1, dctx->origin );
|
ceDrawBitmapInRect( hdc, rt.left+2, rt.top+1, dctx->origin );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( isBlank ) {
|
||||||
|
HGDIOBJ forePen = CreatePen( PS_SOLID, 1, foreColorRef );
|
||||||
|
HGDIOBJ oldObj = SelectObject( hdc, forePen );
|
||||||
|
|
||||||
|
/* For some reason, I can't do 1x1 dots in the corners because they
|
||||||
|
don't draw when they're black on the normal tile background. (They
|
||||||
|
do draw when they're white on a black background -- isPending is
|
||||||
|
true.). But if they're 2 pixels in size they do draw. Bug? I'll
|
||||||
|
work around it with larger braces in the corners. */
|
||||||
|
|
||||||
|
Rectangle( hdc, rt.left, rt.top, rt.left + 2, rt.top + 1 );
|
||||||
|
Rectangle( hdc, rt.left, rt.top, rt.left + 1, rt.top + 2 );
|
||||||
|
|
||||||
|
Rectangle( hdc, rt.right - 2, rt.bottom - 1, rt.right, rt.bottom );
|
||||||
|
Rectangle( hdc, rt.right - 1, rt.bottom - 2, rt.right, rt.bottom );
|
||||||
|
|
||||||
|
Rectangle( hdc, rt.right - 2, rt.top, rt.right, rt.top + 1 );
|
||||||
|
Rectangle( hdc, rt.right - 1, rt.top, rt.right, rt.top + 2 );
|
||||||
|
|
||||||
|
Rectangle( hdc, rt.left, rt.bottom - 2, rt.left + 1, rt.bottom );
|
||||||
|
Rectangle( hdc, rt.left, rt.bottom - 1, rt.left + 2, rt.bottom );
|
||||||
|
|
||||||
|
SelectObject( hdc, oldObj );
|
||||||
|
DeleteObject( forePen );
|
||||||
|
}
|
||||||
|
|
||||||
return XP_TRUE;
|
return XP_TRUE;
|
||||||
} /* ce_draw_drawCell */
|
} /* ce_draw_drawCell */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue