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