rt300@0
|
1 //
|
rt300@0
|
2 // TextPanel.mm
|
rt300@0
|
3 // tweakathlon
|
rt300@0
|
4 //
|
rt300@0
|
5 // Created by Robert Tubb on 05/03/2014.
|
rt300@0
|
6 //
|
rt300@0
|
7 //
|
rt300@0
|
8
|
rt300@0
|
9 #include "TextPanel.h"
|
rt300@0
|
10
|
rt300@0
|
11 TextPanel::TextPanel(string text, int ax, int ay,int aw,int ah, const UIProps& props):
|
rt300@0
|
12 UIElement(ax,ay,aw,ah, props)
|
rt300@0
|
13
|
rt300@0
|
14
|
rt300@0
|
15 {
|
rt300@0
|
16 labelName = text;
|
rt300@0
|
17 foregroundHi = props.buttonHi;
|
rt300@0
|
18 backgroundHi = props.generalBackground;
|
rt300@0
|
19 foregroundLo = props.buttonLo;
|
rt300@0
|
20 backgroundLo = props.generalBackground;
|
rt300@0
|
21 verdana16 = props.verdana16;
|
rt300@0
|
22 bigFont = props.bigFont;
|
rt300@0
|
23 smallFont = props.smallFont;
|
rt300@0
|
24 transparent = true;
|
rt300@0
|
25 };
|
rt300@0
|
26
|
rt300@0
|
27 //------------------------------------------------------------------
|
rt300@0
|
28 void TextPanel::draw(){
|
rt300@0
|
29 if (hidden) return;
|
rt300@38
|
30 ofDisableDepthTest();
|
rt300@0
|
31 if(!transparent) UIElement::draw(); // should do background
|
rt300@0
|
32 ofSetColor(foregroundHi);
|
rt300@0
|
33
|
rt300@0
|
34 // TODO check for fitting inside??
|
rt300@0
|
35 if(fontSize == SMALLFONT){
|
rt300@0
|
36 smallFont.drawString(theText, x, y + 8);
|
rt300@0
|
37 }else if(fontSize == LARGEFONT){
|
rt300@22
|
38 bigFont.drawString(theText, x, y + 16);
|
rt300@0
|
39 }else{
|
rt300@22
|
40 verdana16.drawString(theText, x, y + 12);
|
rt300@0
|
41 }
|
rt300@0
|
42
|
rt300@0
|
43 //ofRect(x,y,width,height);
|
rt300@0
|
44 } |