annotate UI code/targetSymbol.h @ 52:89944ab3e129 tip

fix oF linker errors ios8
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 03 Feb 2015 13:18:23 +0000
parents a223551fdc1f
children
rev   line source
rt300@0 1 //
rt300@0 2 // targetSymbol.h
rt300@0 3 // tweakathlon
rt300@0 4 //
rt300@0 5 // Created by Robert Tubb on 11/02/2014.
rt300@0 6 //
rt300@0 7 //
rt300@0 8
rt300@0 9 #ifndef __tweakathlon__targetSymbol__
rt300@0 10 #define __tweakathlon__targetSymbol__
rt300@0 11
rt300@0 12 #include <iostream>
rt300@0 13 #include "UIElement.h"
rt300@0 14 #include "timeController.h"
rt300@0 15 extern TimeController timeController;
rt300@0 16 class TargetSymbol : public UIElement {
rt300@0 17 public:
rt300@0 18
rt300@0 19 TargetSymbol(int ax, int ay,int aw, const UIProps& props):
rt300@0 20 UIElement(ax,ay,aw,aw, props)
rt300@0 21 {
rt300@0 22 foregroundHi = props.buttonHi;
rt300@0 23 backgroundHi = props.generalBackground;
rt300@0 24 foregroundLo = props.inactiveGreyedOut; // can't be touched
rt300@0 25 backgroundLo = props.generalBackground;
rt300@0 26 flashing = false;
rt300@0 27 on = false;
rt300@0 28 };
rt300@0 29
rt300@0 30 void draw(){
rt300@0 31 if(hidden)return;
rt300@0 32 //UIElement::draw(); // don't do background
rt300@0 33 ofColor fg,bg;
rt300@0 34
rt300@0 35 if(on){
rt300@0 36 fg = foregroundHi;
rt300@0 37 bg = backgroundHi;
rt300@0 38 }else{
rt300@0 39 fg = foregroundLo;
rt300@0 40 bg = backgroundLo;
rt300@0 41 }
rt300@0 42 ofSetColor(fg);
rt300@0 43
rt300@0 44 ofEllipse(x,y,width,height);
rt300@0 45
rt300@0 46 ofSetColor(bg);
rt300@0 47 ofEllipse(x,y,width*0.66,height*0.66);
rt300@0 48
rt300@0 49 ofSetColor(fg);
rt300@0 50 ofEllipse(x,y,width*0.33,height*0.33);
rt300@0 51
rt300@0 52 };
rt300@0 53
rt300@0 54 void flash(){
rt300@0 55 // turn hilight on and off
rt300@0 56 if (!flashing){
rt300@0 57 setHighlight(true);
rt300@0 58
rt300@0 59 // set up timer
rt300@0 60 TimerCallbackFunction tcb;
rt300@0 61 tcb = boost::bind(&TargetSymbol::flash, this);
rt300@0 62 timeController.scheduleEvent(tcb, int(ALTERNATION_SPEED/4));
rt300@0 63 flashing = true;
rt300@0 64 }else{
rt300@0 65 setHighlight(false);
rt300@0 66
rt300@0 67 flashing = false;
rt300@0 68 }
rt300@0 69
rt300@0 70 }
rt300@0 71
rt300@0 72 bool handleMyTouch(int x, int y, touchType ttype, int touchID){
rt300@0 73 return false; // or?
rt300@0 74 }
rt300@0 75
rt300@0 76 private:
rt300@0 77 ofColor foregroundHi;
rt300@0 78 ofColor backgroundHi;
rt300@0 79 ofColor foregroundLo;
rt300@0 80 ofColor backgroundLo;
rt300@0 81 ofColor fgInactive;
rt300@0 82 bool flashing;
rt300@0 83 };
rt300@0 84 #endif /* defined(__tweakathlon__targetSymbol__) */