Mercurial > hg > tweakathon2ios
comparison SequenceController.h @ 31:a677c027e3a0
Demo to Simon, kinda works.
4 reps of sequence.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Fri, 21 Nov 2014 17:07:56 +0000 |
parents | e7af34b1af83 |
children | 75202498bee9 |
comparison
equal
deleted
inserted
replaced
30:78b51f924ec1 | 31:a677c027e3a0 |
---|---|
9 #ifndef __riftathon__SequenceGenerator__ | 9 #ifndef __riftathon__SequenceGenerator__ |
10 #define __riftathon__SequenceGenerator__ | 10 #define __riftathon__SequenceGenerator__ |
11 | 11 |
12 #include <iostream> | 12 #include <iostream> |
13 #include "ofMain.h" | 13 #include "ofMain.h" |
14 | 14 #include "presetManager.h" |
15 #define MIN_TARGETS_IN_SEQUENCE 1 | 15 #include "TrainingScoreManager.h" |
16 #define MIN_TARGETS_IN_SEQUENCE 2 | |
16 #define MAX_TARGETS_IN_SEQUENCE 5 | 17 #define MAX_TARGETS_IN_SEQUENCE 5 |
17 #define MIN_TEMPO 60 | 18 #define MIN_TEMPO 60 |
18 #define MAX_TEMPO 300 | 19 #define MAX_TEMPO 300 |
19 #define NUM_TEMPO_STEPS 12 | 20 #define NUM_TEMPO_STEPS 12 |
20 #define NUM_PRESETS 8 | 21 #define NUM_PRESETS 8 |
21 #define SPACER_BARS true | 22 #define SPACER_BARS false |
22 #define NO_GUIDES_LEVEL true | 23 #define NO_GUIDES_LEVEL false |
23 class AnimStep{ | 24 class AnimStep{ |
24 | 25 |
25 | 26 |
26 public: | 27 public: |
27 | 28 |
28 AnimStep(); | 29 AnimStep(); |
29 typedef enum {PREVIEW_NEUTRAL_COUNT, | 30 typedef enum {PREVIEW_NEUTRAL_COUNT, |
30 MATCHING_NEUTRAL_COUNT, | 31 MATCHING_NEUTRAL_COUNT, |
31 PREVIEW_MOVE, | 32 PREVIEW_MOVE, |
32 PREVIEW_HIT, | 33 PREVIEW_HIT, |
34 GUIDED_MOVE, | |
35 GUIDED_HIT, | |
33 MATCHING_MOVE, | 36 MATCHING_MOVE, |
34 MATCHING_HIT} | 37 MATCHING_HIT} |
35 stepType; | 38 stepType; |
36 | 39 |
37 stepType type; | 40 stepType type; |
38 | 41 |
39 float getTimeBetweenTicks(){ | 42 float getTimeBetweenTicks(){ |
40 return 1000* (60.0/tempo); | 43 return 1000* (60.0/tempo); |
41 } | 44 } |
42 int presetIndex; | 45 int presetIndex; |
46 Preset * currentTargetPreset; | |
47 Preset * nextTargetPreset; | |
43 int whichInSequence; | 48 int whichInSequence; |
44 bool isLastOfAll; | 49 bool isLastOfAll; |
45 | 50 |
46 int tempo; | 51 int tempo; |
47 int seqNumber; | 52 int seqNumber; |
48 int runNumber; | 53 int runNumber; |
49 bool isLastOfSeq; | 54 bool isLastOfSeq; |
50 bool isLastOfRun; | 55 bool isLastOfRun; |
51 | 56 |
52 bool showsGuides; // depends on 'level' | 57 bool showsGuides; // depends on 'level' |
58 bool showsIcons; | |
59 bool showsResultsAtEnd; | |
53 | 60 |
54 vector<int> thisSequence; // so that we can show the whole sequence at the top? | 61 vector<int> thisSequence; // so that we can show the whole sequence at the top? |
62 | |
63 TrainingTestResult result; // only applies to steps that were scored. | |
64 | |
65 | |
66 void saveResult(TrainingTestResult result); | |
55 }; | 67 }; |
56 | 68 |
69 // NOT USED | |
57 class Step{ | 70 class Step{ |
58 public: | 71 public: |
59 typedef enum {COUNT_IN, PREVIEW_PREPARER, PREVIEW_DISPLAYER, MATCHING_PREPARER, MATCHING_INTERACTION, MATCHING_RESULT} stepTypes; | 72 typedef enum {COUNT_IN, PREVIEW_PREPARER, PREVIEW_DISPLAYER, MATCHING_PREPARER, MATCHING_INTERACTION, MATCHING_RESULT} stepTypes; |
60 | 73 |
61 Step(); | 74 Step(); |
90 void setAsPreviewPreparer(); | 103 void setAsPreviewPreparer(); |
91 void setAsPreviewPlayer(); | 104 void setAsPreviewPlayer(); |
92 void setAsMatchingPreparer(); | 105 void setAsMatchingPreparer(); |
93 void setAsMatchingInteraction(); | 106 void setAsMatchingInteraction(); |
94 void setAsMatchingFeedback(); | 107 void setAsMatchingFeedback(); |
108 | |
95 | 109 |
96 float getTimeBetweenTicks(){ | 110 float getTimeBetweenTicks(){ |
97 return 1000. * (60.0/tempo); | 111 return 1000. * (60.0/tempo); |
98 } | 112 } |
113 | |
99 }; | 114 }; |
100 | 115 |
101 class SequenceController{ | 116 class SequenceController{ |
102 public: | 117 public: |
103 SequenceController(); | 118 SequenceController(); |
104 AnimStep getNextStep(); | 119 AnimStep getNextStep(); |
105 void setToStart(); | 120 void setToStart(); |
106 void stepForward(); | 121 void stepForward(); |
107 float getStartTickTime(); | 122 float getStartTickTime(); |
123 void saveResultForCurrentStep(TrainingTestResult result); | |
124 TrainingTestResult getResultForPreviousStep(); | |
108 private: | 125 private: |
109 void generateSteps(); | 126 void generateSteps(); |
110 void generateCountIn(int countInLength); | 127 void generateCountIn(int countInLength); |
111 void generateARun(int run, int numInSequence); | 128 void generateARun(int run, int numInSequence); |
112 vector<int> randomSequence(int numInSequence); | 129 vector<int> randomSequence(int numInSequence); |