view 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
line wrap: on
line source
//
//  textLabel.h
//  tweakathlon
//
//  Created by Robert Tubb on 10/02/2014.
//
//

#ifndef __tweakathlon__textLabel__
#define __tweakathlon__textLabel__

#include <iostream>
#include "ofMain.h"
#include "UIElement.h"
#include "timeController.h"
#include "boost/function.hpp"
#include "boost/bind.hpp"
// actuall a countdown box
extern TimeController timeController;
class TextLabel : public UIElement{
public:

    TextLabel(string text, int x, int y,int w,int h, const UIProps& props);
    void draw();
    
    void setText(string at){
        labelName = at;
    };
    
    ofColor foregroundHi;
    ofColor backgroundHi;
    ofColor foregroundLo;
    ofColor backgroundLo;
    
    bool handleMyTouch(int x, int y, touchType ttype, int touchID){
        return false;
    }
    
    void showAndStart(int sec){
        show();
        stringstream s;
        s << sec;
        labelName = s.str();
        t = sec;
        timeController.scheduleEvent(tcb, 1000);
    };
        
    void secPassed(){
        t--;
        if(t <= 0){
            //finish
            labelName = "!";
        }else{
            stringstream ts;
            ts << t;
            labelName = ts.str();
            timeController.scheduleEvent(tcb, 1000);
        }
    };
private:
    int t;
    TimerCallbackFunction tcb;
    
};

#endif /* defined(__tweakathlon__textLabel__) */