diff testApp.mm @ 14:f83635861187

rewrote sequence controller. ticks show relevant UI modes. images show for preset textures (but greenish?)
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 21 Oct 2014 16:39:39 +0100
parents af71bf84660f
children e439bf85b665
line wrap: on
line diff
--- a/testApp.mm	Mon Oct 20 19:36:39 2014 +0100
+++ b/testApp.mm	Tue Oct 21 16:39:39 2014 +0100
@@ -13,9 +13,7 @@
     ofxiPhoneSetOrientation( OF_ORIENTATION_90_LEFT );
     //ofxiPhoneExternalDisplay::mirrorOn();
     [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
-    // initilaise
-    
-    
+
     initialiseVariables();
 
     
@@ -33,20 +31,15 @@
     initialiseMIDI();
     setupUIElements();
 
+    
 
-
-    
-    light.setSpotlight(45. , 1.);
-    light.enable();
-    ofEnableSeparateSpecularLight();
+//    
+//    light.setSpotlight(45. , 1.);
+//    light.enable();
+//    ofEnableSeparateSpecularLight();
     ofEnableDepthTest();
     ofEnableAlphaBlending();
     // in setup:
-    myfont.loadFont("NewMedia Fett.ttf", 32);
-    
-    verdBig.loadFont("verdana.ttf", 18, true, true);
-	verdBig.setLineHeight(18.0f);
-	verdBig.setLetterSpacing(1.037);
 
     //--------------------------------------
     
@@ -98,7 +91,7 @@
 	// open an outgoing connection to HOST:PORT for OSC
 	// sender.setup( OSC_HOST, OSC_PORT );
     ofSetFrameRate(60);
-    
+    props = new UIProps();
 
 }
 //---------------------------------------------------------
@@ -125,11 +118,11 @@
 //--------------------------------------------------------------
 // gui for the main training stage
 void testApp::setupTrainingViewPanels(){
-    UIProps p;
-    ButtonPanel* bottomButtonPanel = new ButtonPanel(1,160+p.sliderPanelHeight,ofGetWidth(),250,p);
+
+    ButtonPanel* bottomButtonPanel = new ButtonPanel(1,160+props->sliderPanelHeight,ofGetWidth(),250,*props);
     
     // play and submit are now same thing
-    Buttron * playCandidateButton = new Buttron(p.buttonWidth*1.4,680, p);
+    Buttron * playCandidateButton = new Buttron(props->buttonWidth*1.4,680, *props);
     playCandidateButton->setLabel("PLAY");
     trainingMessageOrganiser.mapButtonToAction(playCandidateButton, TRIGGER_CANDIDATE_ID);
     bottomButtonPanel->addButton(playCandidateButton);
@@ -138,45 +131,50 @@
     UIElements.push_back(bottomButtonPanel);
     bottomButtonPanel->hide();
     
-    IconPanel* iconPanel = new IconPanel(200, 10, 200, 150, p);
+    IconPanel* iconPanel = new IconPanel(420, 10, 150, 150, *props);
     trainingMessageOrganiser.setIconPanel(iconPanel);
     UIElements.push_back(iconPanel);
     iconPanel->show();
     
+    TextPanel * instructionPanel = new TextPanel("Instrcution panel", 10, 50, 300,150,(*props));
+    instructionPanel->setFontSize(LARGEFONT);
+    UIElements.push_back(instructionPanel);
+    trainingMessageOrganiser.setInstructionPanel(instructionPanel);
+    instructionPanel->show();
+    
 }
 //--------------------------------------------------------------
 // gui for the old style tweakathlon  stage
 void testApp::setupSearchViewPanels(){
+
+    ButtonPanel* bottomButtonPanel = new ButtonPanel(1,160+(*props).sliderPanelHeight,ofGetWidth(),250,(*props));
     
-    UIProps p;
-    ButtonPanel* bottomButtonPanel = new ButtonPanel(1,160+p.sliderPanelHeight,ofGetWidth(),250,p);
-    
-    Buttron* playTargetButton = new Buttron(p.buttonWidth*0.2,680, p);
+    Buttron* playTargetButton = new Buttron((*props).buttonWidth*0.2,680, (*props));
     playTargetButton->setLabel("Target");
     searchMessageOrganiser.mapButtonToAction(playTargetButton, TRIGGER_TARGET_ID);
     bottomButtonPanel->addButton(playTargetButton);
     searchMessageOrganiser.setTargetButton(playTargetButton);
     
-    Buttron * playCandidateButton = new Buttron(p.buttonWidth*1.4,680, p);
+    Buttron * playCandidateButton = new Buttron((*props).buttonWidth*1.4,680, (*props));
     playCandidateButton->setLabel("Current");
     searchMessageOrganiser.mapButtonToAction(playCandidateButton, TRIGGER_CANDIDATE_ID);
     bottomButtonPanel->addButton(playCandidateButton);
     
     
     // submit button - only one for now
-    Buttron * submitButton = new Buttron(ofGetWidth()*0.5 - p.buttonWidth*0.5,680, p);
+    Buttron * submitButton = new Buttron(ofGetWidth()*0.5 - (*props).buttonWidth*0.5,680, (*props));
     submitButton->setLabel("Submit");
     searchMessageOrganiser.mapButtonToAction(submitButton, SUBMIT_CANDIDATE);
     bottomButtonPanel->addButton(submitButton);
     
     //  button - just for spacing pruposes
-    Buttron * saveButton = new Buttron(ofGetWidth()*0.5 - p.buttonWidth*0.5,680, p);
+    Buttron * saveButton = new Buttron(ofGetWidth()*0.5 - (*props).buttonWidth*0.5,680, (*props));
     saveButton->setLabel("SAVE");
     searchMessageOrganiser.mapButtonToAction(saveButton, SAVE_PRESET_HIT);
     bottomButtonPanel->addButton(saveButton);
     saveButton->hide();
     
-    Buttron * recallButton = new Buttron(ofGetWidth()*0.5 - p.buttonWidth*0.5,680, p);
+    Buttron * recallButton = new Buttron(ofGetWidth()*0.5 - (*props).buttonWidth*0.5,680, (*props));
     recallButton->setLabel("RECALL");
     searchMessageOrganiser.mapButtonToAction(recallButton, RECALL_PRESET_HIT);
     bottomButtonPanel->addButton(recallButton);
@@ -188,18 +186,18 @@
     bottomButtonPanel->hide();
 // -   -   - - - -- -  - OTHER BITS
     
-    CountdownText * countDownBox = new CountdownText("5" , 500, 380, 455, 455, p);
+    CountdownText * countDownBox = new CountdownText("5" , 500, 380, 455, 455, (*props));
     UIElements.push_back(countDownBox);
     searchMessageOrganiser.setCountdownPanel(countDownBox);
     countDownBox->hide();
     
-    TextPanel * scoreFeedback = new TextPanel("Feedback panel", ofGetWidth()*0.5 - p.buttonWidth*0.5, 666, 400,100,p);
+    TextPanel * scoreFeedback = new TextPanel("Feedback panel", ofGetWidth()*0.5 - (*props).buttonWidth*0.5, 666, 400,100,(*props));
     scoreFeedback->setFontSize(SMALLFONT);
     UIElements.push_back(scoreFeedback);
     searchMessageOrganiser.setScorePanel(scoreFeedback);
     scoreFeedback->hide();
     
-    TextPanel * finishPanel = new TextPanel("Finish txt panel", 250, 250, 1000,400,p);
+    TextPanel * finishPanel = new TextPanel("Finish txt panel", 250, 250, 1000,400,(*props));
     finishPanel->setFontSize(LARGEFONT);
     finishPanel->setText("Experiment completed");
     searchMessageOrganiser.setFinishPanel(finishPanel);
@@ -208,14 +206,14 @@
     finishPanel->hide();
     
     
-    Buttron * newTestButton = new Buttron(ofGetWidth()-300,690, p);
+    Buttron * newTestButton = new Buttron(ofGetWidth()-300,690, (*props));
     newTestButton->setLabel("Next Test");
     UIElements.push_back(newTestButton);
     searchMessageOrganiser.mapButtonToAction(newTestButton, NEW_TEST_ID);
     newTestButton->hide();
     searchMessageOrganiser.setNewTestButton(newTestButton);
     
-    TargetSymbol* targetSymbol = new TargetSymbol(ofGetWidth()*0.5,160,30,p);
+    TargetSymbol* targetSymbol = new TargetSymbol(ofGetWidth()*0.5,160,30,(*props));
     searchMessageOrganiser.setTargetSymbol(targetSymbol);
     UIElements.push_back(targetSymbol);
     
@@ -229,8 +227,8 @@
     SliderPanel * controlPanel = new SliderPanel(1,
                                                  160,
                                                  ofGetWidth(),
-                                                 p.sliderPanelHeight,
-                                                 p,
+                                                 (*props).sliderPanelHeight,
+                                                 (*props),
                                                  sl2);
     
     UIElements.push_back(controlPanel);
@@ -241,8 +239,7 @@
 //--------------------------------------------------------------
 void testApp::setupUIElements(){
 
-    UIProps p;
-    ofBackground(p.generalBackground);
+    ofBackground((*props).generalBackground);
 
     setupSearchViewPanels();
 
@@ -516,7 +513,7 @@
     if (currentStage == SEARCH)
         searchMessageOrganiser.drawScore();
     
-    
+    //image.draw(10,10,200,200);
 
 }
 //------------------------------------------------------------------------