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