Make text drawing mode a strict enum

This commit is contained in:
2014-11-29 19:41:54 -05:00
parent 6fae493080
commit a9ea0a114c
11 changed files with 166 additions and 173 deletions

View File

@@ -65,9 +65,9 @@ void cButton::draw(){
rect_draw_some_item(buttons[btnGW[type]],from_rect,*inWindow,to_rect,sf::BlendAlpha);
style.colour = sf::Color::Black;
style.lineHeight = 8;
int textMode = 1;
eTextMode textMode = eTextMode::CENTRE;
if(type == BTN_TINY) {
textMode = 2;
textMode = eTextMode::LEFT_TOP;
to_rect.left += 18;
} else if(type == BTN_PUSH) {
to_rect.top += 34;
@@ -256,7 +256,7 @@ void cLed::draw(){
style.colour = parent->defTextClr;
to_rect.right = frame.right;
to_rect.left = frame.left + 18; // Possibly could be 20
win_draw_string(*inWindow,to_rect,lbl,2,style);
win_draw_string(*inWindow,to_rect,lbl,eTextMode::LEFT_TOP,style);
}else{
tileImage(*inWindow,frame,bg_gworld,bg[parent->bg]);
}

View File

@@ -123,8 +123,7 @@ void cTextField::draw(){
ip_timer.restart();
}
}
// TODO: Update win_draw_string to take a std::string
win_draw_string(*inWindow, rect, contents, 0, style);
win_draw_string(*inWindow, rect, contents, eTextMode::WRAP, style);
}
void cTextField::handleInput(cKey key) {

View File

@@ -115,11 +115,11 @@ void cTextMsg::draw(){
if (to_rect.bottom - to_rect.top < 20) { // essentially, it's a single line
style.lineHeight = 12;
to_rect.left += 3;
win_draw_string(*inWindow,to_rect,lbl,3,style);
win_draw_string(*inWindow,to_rect,lbl,eTextMode::LEFT_BOTTOM,style);
}else {
style.lineHeight = textSize + 2;
to_rect.inset(4,4);
win_draw_string(*inWindow,to_rect,lbl,0,style);
win_draw_string(*inWindow,to_rect,lbl,eTextMode::WRAP,style);
}
}
}