Remove c_str() calls made redundant by the previous commit

This commit is contained in:
2014-04-15 21:18:36 -04:00
parent f91ca72631
commit 6060ba6750
8 changed files with 22 additions and 23 deletions

View File

@@ -74,7 +74,7 @@ void cButton::draw(){
} else if(type == BTN_PUSH) {
to_rect.top += 34;
}
win_draw_string(*inWindow,to_rect,lbl.c_str(),textMode,8);
win_draw_string(*inWindow,to_rect,lbl,textMode,8);
// TODO: Adjust string location as appropriate
// Tiny button string location should be shifted right 20 pixels (or possibly 18)
// Push button string should be centred below the button
@@ -258,7 +258,7 @@ void cLed::draw(){
TEXT.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.c_str(),2,8);
win_draw_string(*inWindow,to_rect,lbl,2,8);
TEXT.colour = sf::Color::Black;
}else{
tileImage(*inWindow,frame,bg_gworld,bg[parent->bg]);

View File

@@ -268,7 +268,7 @@ void cThreeChoice::init_strings(std::vector<std::string>& strings, unsigned shor
RECT cur_text_rect = {2, left, 0, 0};
size_t total_len, str_width, str_height;
for (unsigned int i = 0; i < strings.size(); i++)
total_len += string_length(strings[i].c_str());
total_len += string_length(strings[i]);
total_len = total_len * 12;
str_width = s_sqrt(total_len) + 20;
//print_nums(0,total_len,str_width);
@@ -279,7 +279,7 @@ void cThreeChoice::init_strings(std::vector<std::string>& strings, unsigned shor
for(unsigned int j = 0; j < strings.size(); j++){
std::ostringstream sout;
sout << "str" << j + 1;
str_height = ((string_length(strings[j].c_str()) + 60) / str_width) * 12 + 16;
str_height = ((string_length(strings[j]) + 60) / str_width) * 12 + 16;
cur_text_rect.bottom = cur_text_rect.top + str_height;
cTextMsg* str = new cTextMsg(me);
str->setText(strings[j]);

View File

@@ -97,10 +97,10 @@ void cTextField::draw(){
if(haveFocus) {
std::string pre_ip = contents.substr(0, insertionPoint);
// TODO: Update string_length to take a std::string
ip_offset = string_length(pre_ip.c_str());
ip_offset = string_length(pre_ip);
if(insertionPoint != selectionPoint) {
std::string pre_sel = contents.substr(0, selectionPoint);
sel_offset = string_length(pre_sel.c_str());
sel_offset = string_length(pre_sel);
int sel_start = std::min(ip_offset, sel_offset) + 1;
int sel_width = abs(ip_offset - sel_offset) + 3;
RECT selectRect = frame;
@@ -122,7 +122,7 @@ void cTextField::draw(){
}
}
// TODO: Update win_draw_string to take a std::string
win_draw_string(*inWindow, rect, contents.c_str(), 0, 14);
win_draw_string(*inWindow, rect, contents, 0, 14);
}
void cTextField::handleInput(cKey key) {

View File

@@ -102,10 +102,10 @@ void cTextMsg::draw(){
TEXT.colour = draw_color;
if (to_rect.bottom - to_rect.top < 20) { // essentially, it's a single line
to_rect.left += 3;
win_draw_string(*inWindow,to_rect,lbl.c_str(),3,12);
win_draw_string(*inWindow,to_rect,lbl,3,12);
}else {
to_rect.inset(4,4);
win_draw_string(*inWindow,to_rect,lbl.c_str(),0,textSize + 2);
win_draw_string(*inWindow,to_rect,lbl,0,textSize + 2);
}
}
}