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:
Eric House 2013-05-31 07:40:42 -07:00
parent d41c1a4ca8
commit 9d40930fff
3 changed files with 24 additions and 5 deletions

View file

@ -488,12 +488,12 @@ and_draw_score_pendingScore( DrawCtx* dctx, const XP_Rect* rect,
XP_S16 score, XP_U16 playerNum,
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 );
(*env)->CallVoidMethod( env, draw->jdraw, mid,
jrect, score, playerNum, flags );
jrect, score, playerNum, curTurn, flags );
}
static void

View file

@ -888,14 +888,19 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
}
public void score_pendingScore( Rect rect, int score, int playerNum,
int flags )
int curTurn, int flags )
{
String text = score >= 0? String.format( "%d", score ) : "??";
int otherIndx = (0 == (flags & CELL_ISCURSOR))
? CommonPrefs.COLOR_BACKGRND : CommonPrefs.COLOR_FOCUS;
++rect.top;
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;
drawCentered( text, rect, null );
@ -1258,4 +1263,17 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
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;
}
}

View file

@ -68,7 +68,8 @@ public interface DrawCtx {
int flags );
void drawTileBack( 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_DOUBLE_LETTER = 1;