comparison UI code/Buttron.mm @ 26:8d7ae43b2edd

BLOODY FIIDDLY MOFO THIS ONE
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 28 Oct 2014 19:15:28 +0000
parents 8124f46eda65
children fea11c3d1d94
comparison
equal deleted inserted replaced
25:8eb530e0601b 26:8d7ae43b2edd
75 on = false; 75 on = false;
76 } 76 }
77 //------------------------------------------------------------------ 77 //------------------------------------------------------------------
78 void Buttron::draw(){ 78 void Buttron::draw(){
79 if(hidden) return; 79 if(hidden) return;
80
81 ofDisableDepthTest();
80 //cout << "drawing button" << endl; 82 //cout << "drawing button" << endl;
81 ofFill(); 83 ofFill();
82 UIElement::draw(); // should do background 84 UIElement::draw(); // should do background
83 drawOutline(); 85 drawOutline();
84 drawTextLabel(); 86 drawTextLabel();
87
88 ofEnableDepthTest();
85 } 89 }
86 //------------------------------------------------------------------ 90 //------------------------------------------------------------------
87 void Buttron::drawTextLabel(){ 91 void Buttron::drawTextLabel(){
88 ofColor fg,bg; 92 ofColor fg,bg;
89 93
97 if(inactive){ 101 if(inactive){
98 fg = fgInactive; 102 fg = fgInactive;
99 } 103 }
100 ofSetColor(fg); 104 ofSetColor(fg);
101 verdana16.drawString(labelName, x + thickness*2, y + 35); 105 verdana16.drawString(labelName, x + thickness*2, y + 35);
106
102 107
103 } 108 }
104 //------------------------------------------------------------------ 109 //------------------------------------------------------------------
105 void Buttron::drawOutline(){ 110 void Buttron::drawOutline(){
106 111
159 164
160 // fill in background 165 // fill in background
161 ofRect(x+cornerSize,y+thickness,width-2*cornerSize,height-2*thickness); 166 ofRect(x+cornerSize,y+thickness,width-2*cornerSize,height-2*thickness);
162 ofRect(x+thickness, y+cornerSize, radius, height-2*cornerSize); 167 ofRect(x+thickness, y+cornerSize, radius, height-2*cornerSize);
163 ofRect(x+width-cornerSize, y+cornerSize, radius, height-2*cornerSize); 168 ofRect(x+width-cornerSize, y+cornerSize, radius, height-2*cornerSize);
169
170
164 } 171 }
165 //------------------------------------------------------------------------------ 172 //------------------------------------------------------------------------------
166 bool Buttron::handleMyTouch(int tx, int ty, touchType ttype, int touchID){ 173 bool Buttron::handleMyTouch(int tx, int ty, touchType ttype, int touchID){
167 174
168 //cout << "buttron handling touch\n"; 175 //cout << "buttron handling touch\n";