summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
902e053)
Change-Id: I167f5872ff0480ffca96548d158242794854e908
Signed-off-by: gitknilch <gitknilch@cwde.de>
class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
+ private static final String COLOR_TEXT = "#FFFFFF";
+ private static final String COLOR_TEXT_SHADOW = "#000000";
+ private static final String COLOR_HINT = "#F0C000";
+ private static final String COLOR_SELECTED = "#FF0000";
+
private enum StatePlay { UNINITIALIZED, IDLE, SELECTED1, SELECTED2, GAMEOVER };
private enum StatePaint { BOARD, SELECTED1, SELECTED2, MATCHED, WIN, LOSE, HINT, TIME };
private enum StatePlay { UNINITIALIZED, IDLE, SELECTED1, SELECTED2, GAMEOVER };
private enum StatePaint { BOARD, SELECTED1, SELECTED2, MATCHED, WIN, LOSE, HINT, TIME };
}
@SuppressWarnings("deprecation")
}
@SuppressWarnings("deprecation")
- public void drawMessage(Canvas canvas, int x, int y, boolean centered, String message, String color, float textSize) {
+ public static void drawMessage(Canvas canvas, int x, int y,
+ boolean centered, String message, float textSize) {
Paint paint = new Paint();
Paint paint = new Paint();
- paint.setColor(Color.parseColor(color));
paint.setLinearText(true);
paint.setAntiAlias(true);
paint.setLinearText(true);
paint.setAntiAlias(true);
- paint.setTextAlign(centered?Align.CENTER:Align.LEFT);
+ paint.setTextAlign(centered ? Align.CENTER : Align.LEFT);
paint.setTypeface(Typeface.SANS_SERIF);
paint.setFakeBoldText(true);
paint.setTextSize(textSize);
paint.setTypeface(Typeface.SANS_SERIF);
paint.setFakeBoldText(true);
paint.setTextSize(textSize);
+ paint.setColor(Color.parseColor(COLOR_TEXT_SHADOW));
+ canvas.drawText(message, x + 1, y + 1, paint);
+ paint.setColor(Color.parseColor(COLOR_TEXT));
canvas.drawText(message, x, y, paint);
}
canvas.drawText(message, x, y, paint);
}
y0=(screenHeight-app.board.boardSize[0]*tileHeight)/2;
}
y0=(screenHeight-app.board.boardSize[0]*tileHeight)/2;
}
- int red = Color.parseColor("#FF0000");
- int orange = Color.parseColor("#F0C000");
+ int selectcolor = Color.parseColor(COLOR_SELECTED);
+ int hintcolor = Color.parseColor(COLOR_HINT);
Paint paint = new Paint();
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
Paint paint = new Paint();
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
case SELECTED1:
case SELECTED2:
case MATCHED:
case SELECTED1:
case SELECTED2:
case MATCHED:
+ paint.setColor(selectcolor);
paint.setStyle(Style.STROKE);
paint.setStrokeCap(Cap.ROUND);
paint.setStrokeJoin(Join.ROUND);
paint.setStyle(Style.STROKE);
paint.setStrokeCap(Cap.ROUND);
paint.setStrokeJoin(Join.ROUND);
switch (pstate) {
case SELECTED2:
case MATCHED:
switch (pstate) {
case SELECTED2:
case MATCHED:
+ paint.setColor(selectcolor);
paint.setStyle(Style.STROKE);
paint.setStrokeCap(Cap.ROUND);
paint.setStrokeJoin(Join.ROUND);
paint.setStyle(Style.STROKE);
paint.setStrokeCap(Cap.ROUND);
paint.setStrokeJoin(Join.ROUND);
// Matching path
switch (pstate) {
case MATCHED:
// Matching path
switch (pstate) {
case MATCHED:
+ paint.setColor(selectcolor);
paint.setStyle(Style.STROKE);
paint.setStrokeCap(Cap.ROUND);
paint.setStrokeJoin(Join.ROUND);
paint.setStyle(Style.STROKE);
paint.setStrokeCap(Cap.ROUND);
paint.setStrokeJoin(Join.ROUND);
Point a=pair.a;
Point b=pair.b;
path=app.board.getPath(a,b);
Point a=pair.a;
Point b=pair.b;
path=app.board.getPath(a,b);
- paint.setColor(orange);
+ paint.setColor(hintcolor);
paint.setStyle(Style.STROKE);
paint.setStrokeCap(Cap.ROUND);
paint.setStrokeJoin(Join.ROUND);
paint.setStyle(Style.STROKE);
paint.setStrokeCap(Cap.ROUND);
paint.setStrokeJoin(Join.ROUND);
// Win & loose notifications
switch (pstate) {
case WIN:
// Win & loose notifications
switch (pstate) {
case WIN:
- drawMessage(cbuffer, screenWidth/2,screenHeight/2,true,"You Win!", "#FFFFFF", 100);
+ drawMessage(cbuffer, screenWidth / 2, screenHeight / 2, true,
+ "You Win!", 100);
- drawMessage(cbuffer, screenWidth/2,screenHeight/2,true,"Game Over", "#FFFFFF", 100);
+ drawMessage(cbuffer, screenWidth / 2, screenHeight / 2, true,
+ "Game Over", 100);
case HINT:
case TIME:
updateTime();
case HINT:
case TIME:
updateTime();
- int hours=(int)(playTime/(60*60));
- int minutes=(int)((playTime/60)%60);
- int seconds=(int)(playTime%60);
- String time=String.format(Locale.US, "%01d:%02d:%02d", hours, minutes, seconds);
+ int hours = (int) (playTime / (60 * 60));
+ int minutes = (int) ((playTime / 60) % 60);
+ int seconds = (int) (playTime % 60);
+ String time = String.format(Locale.US, "%01d:%02d:%02d",
+ hours, minutes, seconds);
int timePosX=screenWidth-120;
int timePosY=screenHeight-10;
int timePosX=screenWidth-120;
int timePosY=screenHeight-10;
- drawMessage(cbuffer, timePosX+1,timePosY+1,false,time,"#000000",30);
- drawMessage(cbuffer, timePosX,timePosY,false,time,"#FFFFFF",30);
+ drawMessage(cbuffer, timePosX, timePosY, false, time, 30);