More prominent final score
This commit is contained in:
parent
162186cea1
commit
c3a1773837
3 changed files with 21 additions and 3 deletions
|
@ -206,7 +206,7 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
|
|||
// if(!currentScenario.isWithinTime(timestamp))
|
||||
if(currentScenario.isFinished())
|
||||
{
|
||||
setText(String.format("LEVEL ENDED\nScore: %.2f", currentScenario.getTotalScore()));
|
||||
setText("LEVEL ENDED");
|
||||
stopDetector();
|
||||
restartButton.setVisibility(View.VISIBLE);
|
||||
return;
|
||||
|
|
|
@ -40,6 +40,7 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
|
|||
private Paint attrScorePaint = new Paint();
|
||||
private Paint linePaint = new Paint();
|
||||
private Paint scorePaint = new Paint();
|
||||
private Paint scoreFinishedPaint = new Paint();
|
||||
|
||||
// see: http://blog.danielnadeau.io/2012/01/android-canvas-beginners-tutorial.html
|
||||
class PanelThread extends Thread {
|
||||
|
@ -90,6 +91,11 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
|
|||
scorePaint.setTextSize(50);
|
||||
scorePaint.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
|
||||
scoreFinishedPaint.setColor(Color.YELLOW);
|
||||
scoreFinishedPaint.setTextSize(100);
|
||||
scoreFinishedPaint.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
|
||||
|
||||
//setup paints for drawing
|
||||
mainPaint.setColor(Color.GRAY);
|
||||
|
||||
|
@ -206,7 +212,14 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
|
|||
// canvas.drawText(target_text, cx, y_pos + diff_y , emoPaint);
|
||||
}
|
||||
|
||||
canvas.drawText("Total: " + Float.toString(_scenario.getTotalScore()), 50, 50, scorePaint);
|
||||
// draw the score middle bottom;
|
||||
Paint usedScorePaint = _scenario.isFinished() ? scoreFinishedPaint : scorePaint;
|
||||
String scoreText = String.format("Total: %1$.0f", _scenario.getTotalScore());
|
||||
Rect scoreTextBounds = new Rect();
|
||||
usedScorePaint.getTextBounds(scoreText, 0, scoreText.length(), scoreTextBounds);
|
||||
|
||||
canvas.drawText(scoreText, (width - scoreTextBounds.width()) / 2, height - 10, usedScorePaint);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,12 @@
|
|||
android:text="@string/dummy_content"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="50sp"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:paddingBottom="100dp"
|
||||
android:shadowColor="@android:color/black"
|
||||
android:shadowDx="0"
|
||||
android:shadowDy="0"
|
||||
android:shadowRadius="20" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
|
|
Loading…
Reference in a new issue