From 1dcb08a932ee4eb8b8bed11b4f6c2e0e07f27355 Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 17 Aug 2016 19:52:27 +0200 Subject: [PATCH] ScenarioAnger split and added emotion labels to ScenarioView --- .../rubenvandeven/emotionhero/Scenario.java | 16 ------------- .../emotionhero/ScenarioAnger.java | 23 +++++++++++++++++++ .../emotionhero/ScenarioView.java | 10 +++++++- 3 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 app/src/main/java/com/rubenvandeven/emotionhero/ScenarioAnger.java diff --git a/app/src/main/java/com/rubenvandeven/emotionhero/Scenario.java b/app/src/main/java/com/rubenvandeven/emotionhero/Scenario.java index 26a0490..a345fd4 100644 --- a/app/src/main/java/com/rubenvandeven/emotionhero/Scenario.java +++ b/app/src/main/java/com/rubenvandeven/emotionhero/Scenario.java @@ -155,19 +155,3 @@ abstract public class Scenario { // TODO: create a 'tick' that checks all current values with requirements and increases the timer etc // TODO: ... if scenario is running. This internal times makes it easier to pause etc. } - -class ScenarioAnger extends Scenario{ - void createScenario() - { - Log.d(GamingActivity.LOG_TAG, "CREATE SCENARIO: anger"); - setTarget(Emotion.ANGER, 10, 1); - setTarget(Emotion.ANGER, 20, 2); - setTarget(Emotion.ANGER, 40, 3); - setTarget(Emotion.ANGER, 70, 4); - setTarget(Emotion.ANGER, 100, 5); - setTarget(Emotion.JOY, 100, 8); - setTarget(Emotion.ANGER, 100, 10); - setTarget(Emotion.JOY, 100, 15); - setTarget(Emotion.ANGER, 100, 20); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/rubenvandeven/emotionhero/ScenarioAnger.java b/app/src/main/java/com/rubenvandeven/emotionhero/ScenarioAnger.java new file mode 100644 index 0000000..31450cd --- /dev/null +++ b/app/src/main/java/com/rubenvandeven/emotionhero/ScenarioAnger.java @@ -0,0 +1,23 @@ +package com.rubenvandeven.emotionhero; + +import android.util.Log; + +/** + * Created by ruben on 17/08/16. + */ + +public class ScenarioAnger extends Scenario { + void createScenario() + { + Log.d(GamingActivity.LOG_TAG, "CREATE SCENARIO: anger"); + setTarget(Emotion.ANGER, 10, 1); + setTarget(Emotion.ANGER, 20, 2); + setTarget(Emotion.ANGER, 40, 3); + setTarget(Emotion.ANGER, 70, 4); + setTarget(Emotion.ANGER, 100, 5); + setTarget(Emotion.JOY, 100, 8); + setTarget(Emotion.ANGER, 100, 10); + setTarget(Emotion.JOY, 100, 15); + setTarget(Emotion.ANGER, 100, 20); + } +} diff --git a/app/src/main/java/com/rubenvandeven/emotionhero/ScenarioView.java b/app/src/main/java/com/rubenvandeven/emotionhero/ScenarioView.java index b3ac382..608d7f3 100644 --- a/app/src/main/java/com/rubenvandeven/emotionhero/ScenarioView.java +++ b/app/src/main/java/com/rubenvandeven/emotionhero/ScenarioView.java @@ -107,6 +107,7 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback linePaint.setStrokeWidth(5); // canvas.drawLine(0, bottomline_height, width, bottomline_height, linePaint); + for(Emotion emotion: Emotion.values()) { float value = 0; @@ -118,6 +119,7 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback } Paint emoPaint = new Paint(); Paint emoPaintOutline = new Paint(); + emoPaint.setTextSize(20); emoPaint.setColor(emotion.getColor()); emoPaintOutline.setColor(emotion.getColor()); emoPaintOutline.setStyle(Paint.Style.STROKE); @@ -132,8 +134,14 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback canvas.drawCircle(cx, cy, max_ball_radius * value/100, emoPaint); + Path emoNamePath = new Path(); + emoNamePath.moveTo(cx, cy + max_ball_radius * 1.5f); +// more curly line to draw on: +// emoNamePath.rCubicTo(width*0.1f,0, width*0.1f, height*0.2f,width*0.2f,height*0.2f); + emoNamePath.rLineTo(1000,1000); - canvas.drawText(emotion.toString(), cx, cy + max_ball_radius * (float) 1.3, emoPaint); +// canvas.drawText(emotion.toString(), cx, cy + max_ball_radius * (float) 1.3, emoPaint); + canvas.drawTextOnPath(emotion.toString(), emoNamePath, 0, 0, emoPaint); } // Draw targets: