mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
pass new param into java, and when it's not the player's turn draw
pending points with his color at half-intensity.
This commit is contained in:
parent
d41c1a4ca8
commit
9d40930fff
3 changed files with 24 additions and 5 deletions
|
@ -488,12 +488,12 @@ and_draw_score_pendingScore( DrawCtx* dctx, const XP_Rect* rect,
|
||||||
XP_S16 score, XP_U16 playerNum,
|
XP_S16 score, XP_U16 playerNum,
|
||||||
XP_S16 curTurn, CellFlags flags )
|
XP_S16 curTurn, CellFlags flags )
|
||||||
{
|
{
|
||||||
DRAW_CBK_HEADER( "score_pendingScore", "(Landroid/graphics/Rect;III)V" );
|
DRAW_CBK_HEADER( "score_pendingScore", "(Landroid/graphics/Rect;IIII)V" );
|
||||||
|
|
||||||
jobject jrect = makeJRect( draw, JCACHE_RECT0, rect );
|
jobject jrect = makeJRect( draw, JCACHE_RECT0, rect );
|
||||||
|
|
||||||
(*env)->CallVoidMethod( env, draw->jdraw, mid,
|
(*env)->CallVoidMethod( env, draw->jdraw, mid,
|
||||||
jrect, score, playerNum, flags );
|
jrect, score, playerNum, curTurn, flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -888,14 +888,19 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
public void score_pendingScore( Rect rect, int score, int playerNum,
|
public void score_pendingScore( Rect rect, int score, int playerNum,
|
||||||
int flags )
|
int curTurn, int flags )
|
||||||
{
|
{
|
||||||
String text = score >= 0? String.format( "%d", score ) : "??";
|
String text = score >= 0? String.format( "%d", score ) : "??";
|
||||||
int otherIndx = (0 == (flags & CELL_ISCURSOR))
|
int otherIndx = (0 == (flags & CELL_ISCURSOR))
|
||||||
? CommonPrefs.COLOR_BACKGRND : CommonPrefs.COLOR_FOCUS;
|
? CommonPrefs.COLOR_BACKGRND : CommonPrefs.COLOR_FOCUS;
|
||||||
++rect.top;
|
++rect.top;
|
||||||
fillRectOther( rect, otherIndx );
|
fillRectOther( rect, otherIndx );
|
||||||
m_fillPaint.setColor( m_playerColors[playerNum] );
|
|
||||||
|
int playerColor = m_playerColors[playerNum];
|
||||||
|
if ( playerNum != curTurn ) {
|
||||||
|
playerColor = dimColor( playerColor );
|
||||||
|
}
|
||||||
|
m_fillPaint.setColor( playerColor );
|
||||||
|
|
||||||
rect.bottom -= rect.height() / 2;
|
rect.bottom -= rect.height() / 2;
|
||||||
drawCentered( text, rect, null );
|
drawCentered( text, rect, null );
|
||||||
|
@ -1258,4 +1263,17 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
return zoomDir;
|
return zoomDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int dimColor( int playerColor )
|
||||||
|
{
|
||||||
|
int newColor = 0;
|
||||||
|
for ( int ii = 0; ii < 4; ++ii ) {
|
||||||
|
int byt = (playerColor >> 24) & 0xFF;
|
||||||
|
playerColor <<= 8;
|
||||||
|
byt += (0xFF - byt) / 2;
|
||||||
|
newColor <<= 8;
|
||||||
|
newColor |= byt;
|
||||||
|
}
|
||||||
|
return newColor;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,8 @@ public interface DrawCtx {
|
||||||
int flags );
|
int flags );
|
||||||
void drawTileBack( Rect rect, int flags );
|
void drawTileBack( Rect rect, int flags );
|
||||||
void drawTrayDivider( Rect rect, int flags );
|
void drawTrayDivider( Rect rect, int flags );
|
||||||
void score_pendingScore( Rect rect, int score, int playerNum, int flags );
|
void score_pendingScore( Rect rect, int score, int playerNum, int curTurn,
|
||||||
|
int flags );
|
||||||
|
|
||||||
public static final int BONUS_NONE = 0;
|
public static final int BONUS_NONE = 0;
|
||||||
public static final int BONUS_DOUBLE_LETTER = 1;
|
public static final int BONUS_DOUBLE_LETTER = 1;
|
||||||
|
|
Loading…
Reference in a new issue