Mercurial > hg > tweakathon2ios
view UI code/targetSymbol.h @ 42:2bd658b44c2d
buttons dont lite up
back to menu shows in more appropriate times
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Mon, 08 Dec 2014 18:29:10 +0000 |
parents | a223551fdc1f |
children |
line wrap: on
line source
// // targetSymbol.h // tweakathlon // // Created by Robert Tubb on 11/02/2014. // // #ifndef __tweakathlon__targetSymbol__ #define __tweakathlon__targetSymbol__ #include <iostream> #include "UIElement.h" #include "timeController.h" extern TimeController timeController; class TargetSymbol : public UIElement { public: TargetSymbol(int ax, int ay,int aw, const UIProps& props): UIElement(ax,ay,aw,aw, props) { foregroundHi = props.buttonHi; backgroundHi = props.generalBackground; foregroundLo = props.inactiveGreyedOut; // can't be touched backgroundLo = props.generalBackground; flashing = false; on = false; }; void draw(){ if(hidden)return; //UIElement::draw(); // don't do background ofColor fg,bg; if(on){ fg = foregroundHi; bg = backgroundHi; }else{ fg = foregroundLo; bg = backgroundLo; } ofSetColor(fg); ofEllipse(x,y,width,height); ofSetColor(bg); ofEllipse(x,y,width*0.66,height*0.66); ofSetColor(fg); ofEllipse(x,y,width*0.33,height*0.33); }; void flash(){ // turn hilight on and off if (!flashing){ setHighlight(true); // set up timer TimerCallbackFunction tcb; tcb = boost::bind(&TargetSymbol::flash, this); timeController.scheduleEvent(tcb, int(ALTERNATION_SPEED/4)); flashing = true; }else{ setHighlight(false); flashing = false; } } bool handleMyTouch(int x, int y, touchType ttype, int touchID){ return false; // or? } private: ofColor foregroundHi; ofColor backgroundHi; ofColor foregroundLo; ofColor backgroundLo; ofColor fgInactive; bool flashing; }; #endif /* defined(__tweakathlon__targetSymbol__) */