view UI code/TextPanel.mm @ 28:953db6518738

leap version more or less there, needs btter results feedback but thats detail. "no movement" bit is stupid cos peopel can move their hand. light flash not work.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Thu, 30 Oct 2014 18:35:00 +0000
parents 8124f46eda65
children fea11c3d1d94
line wrap: on
line source
//
//  TextPanel.mm
//  tweakathlon
//
//  Created by Robert Tubb on 05/03/2014.
//
//

#include "TextPanel.h"

TextPanel::TextPanel(string text, int ax, int ay,int aw,int ah, const UIProps& props):
UIElement(ax,ay,aw,ah, props)


{
    labelName = text;
    foregroundHi = props.buttonHi;
    backgroundHi = props.generalBackground;
    foregroundLo = props.buttonLo;
    backgroundLo = props.generalBackground;
    verdana16 = props.verdana16;
    bigFont = props.bigFont;
    smallFont = props.smallFont;
    transparent = true;
};

//------------------------------------------------------------------
void TextPanel::draw(){
    if (hidden) return;
    if(!transparent) UIElement::draw(); // should do background
    ofSetColor(foregroundHi);
    
    // TODO check for fitting inside??
    if(fontSize == SMALLFONT){
        smallFont.drawString(theText, x, y + 8);
    }else if(fontSize == LARGEFONT){
        bigFont.drawString(theText, x, y + 16);
    }else{
        verdana16.drawString(theText, x, y + 12);
    }
    
    //ofRect(x,y,width,height);
}