- if(pbutton->info)
- text_draw(&white_small_text, pbutton->info, i + pbutton->x - strlen(pbutton->info) * white_small_text.w, pbutton->y, 1, NO_UPDATE);
- sprintf(str,"(%s)", SDL_GetKeyName(pbutton->shortcut));
- text_draw(&white_small_text, str, i + pbutton->x - strlen(str) * white_small_text.w, pbutton->y + white_small_text.h+2, 1, NO_UPDATE);
- }
- if(pbutton->state == BUTTON_PRESSED)
- fillrect(pbutton->x,pbutton->y,pbutton->w,pbutton->h,75,75,75,200);
- else if(pbutton->state == BUTTON_HOVER)
- fillrect(pbutton->x,pbutton->y,pbutton->w,pbutton->h,150,150,150,128);
+ 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, 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 - 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);
+ else if(state == BUTTON_HOVER)
+ fillrect(rect.x,rect.y,rect.w,rect.h,150,150,150,128);