annotate UI code/textLabel.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 // textLabel.h
rt300@0 3 // tweakathlon
rt300@0 4 //
rt300@0 5 // Created by Robert Tubb on 10/02/2014.
rt300@0 6 //
rt300@0 7 //
rt300@0 8
rt300@0 9 #ifndef __tweakathlon__textLabel__
rt300@0 10 #define __tweakathlon__textLabel__
rt300@0 11
rt300@0 12 #include <iostream>
rt300@0 13 #include "ofMain.h"
rt300@0 14 #include "UIElement.h"
rt300@0 15 #include "timeController.h"
rt300@0 16 #include "boost/function.hpp"
rt300@0 17 #include "boost/bind.hpp"
rt300@0 18 // actuall a countdown box
rt300@0 19 extern TimeController timeController;
rt300@0 20 class TextLabel : public UIElement{
rt300@0 21 public:
rt300@0 22
rt300@0 23 TextLabel(string text, int x, int y,int w,int h, const UIProps& props);
rt300@0 24 void draw();
rt300@0 25
rt300@0 26 void setText(string at){
rt300@0 27 labelName = at;
rt300@0 28 };
rt300@0 29
rt300@0 30 ofColor foregroundHi;
rt300@0 31 ofColor backgroundHi;
rt300@0 32 ofColor foregroundLo;
rt300@0 33 ofColor backgroundLo;
rt300@0 34
rt300@0 35 bool handleMyTouch(int x, int y, touchType ttype, int touchID){
rt300@0 36 return false;
rt300@0 37 }
rt300@0 38
rt300@0 39 void showAndStart(int sec){
rt300@0 40 show();
rt300@0 41 stringstream s;
rt300@0 42 s << sec;
rt300@0 43 labelName = s.str();
rt300@0 44 t = sec;
rt300@0 45 timeController.scheduleEvent(tcb, 1000);
rt300@0 46 };
rt300@0 47
rt300@0 48 void secPassed(){
rt300@0 49 t--;
rt300@0 50 if(t <= 0){
rt300@0 51 //finish
rt300@0 52 labelName = "!";
rt300@0 53 }else{
rt300@0 54 stringstream ts;
rt300@0 55 ts << t;
rt300@0 56 labelName = ts.str();
rt300@0 57 timeController.scheduleEvent(tcb, 1000);
rt300@0 58 }
rt300@0 59 };
rt300@0 60 private:
rt300@0 61 int t;
rt300@0 62 TimerCallbackFunction tcb;
rt300@0 63
rt300@0 64 };
rt300@0 65
rt300@0 66 #endif /* defined(__tweakathlon__textLabel__) */