X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fbutton.cpp;h=1cfbc72cf876036c804055147f5915aa2a582db1;hb=308f11e38981077626fe0ea9887094f3c28b02f9;hp=766407e53c09a80a18dfb6e2a5cdb0765764fe3a;hpb=148cc59583752d131847829535a34ce3ad379e06;p=supertux.git diff --git a/src/button.cpp b/src/button.cpp index 766407e53..1cfbc72cf 100644 --- a/src/button.cpp +++ b/src/button.cpp @@ -18,8 +18,9 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. -#include -#include +#include +#include + #include "setup.h" #include "screen/screen.h" #include "screen/drawing_context.h" @@ -119,13 +120,13 @@ void Button::draw(DrawingContext& context) char str[80]; int i = -32; - if(0 > rect.x - (int)strlen(info.c_str()) * white_small_text->w) - i = rect.w + strlen(info.c_str()) * white_small_text->w; + if(0 > rect.x - white_small_text->get_text_width(info)) + i = rect.w + (int)white_small_text->get_text_width(info); if(!info.empty()) - context.draw_text(white_small_text, info.c_str(), Vector(i + rect.x - strlen(info.c_str()) * white_small_text->w, rect.y), LAYER_GUI); + context.draw_text(white_small_text, info, Vector(i + rect.x - white_small_text->get_text_width(info), rect.y), LAYER_GUI); sprintf(str,"(%s)", SDL_GetKeyName(shortcut)); - context.draw_text(white_small_text, str, Vector(i + rect.x - strlen(str) * white_small_text->w, rect.y + white_small_text->h+2), LAYER_GUI); + context.draw_text(white_small_text, str, Vector(i + rect.x - white_small_text->get_text_width(str), rect.y + white_small_text->get_height()+2), LAYER_GUI); } if(state == BUTTON_PRESSED || state == BUTTON_DEACTIVE) fillrect(rect.x,rect.y,rect.w,rect.h,75,75,75,200);