Added a mask to be applied to a sprite.
[supertux.git] / lib / gui / button.cpp
index 8c82519..7b02985 100644 (file)
@@ -30,6 +30,7 @@
 using namespace SuperTux;
 
 Timer Button::popup_timer;
+Font* Button::info_font = 0;
 
 Button::Button(Surface* button_image, const std::string& ninfo,
                SDLKey nshortcut, int x, int y, int mw, int mh)
@@ -79,7 +80,7 @@ void Button::add_icon(const std::string& icon_file, int mw, int mh)
   if(!icon_file.empty())
     {
       snprintf(filename, 1024, "%s/%s", datadir.c_str(), icon_file.c_str());
-      if(!faccessible(filename))
+      if(!FileSystem::faccessible(filename))
         snprintf(filename, 1024, "%s/images/icons/default-icon.png", datadir.c_str());
     }
   else
@@ -121,13 +122,13 @@ void Button::draw(DrawingContext& context)
       char str[80];
       int i = -32;
 
-      if(0 > rect.x - white_small_text->get_text_width(info))
-        i = rect.w + (int)white_small_text->get_text_width(info);
+      if(0 > rect.x - info_font->get_text_width(info))
+        i = rect.w + (int)info_font->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);
+        context.draw_text(info_font, info, Vector(i + rect.x - info_font->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);
+      context.draw_text(info_font, str, Vector(i + rect.x -  info_font->get_text_width(str), rect.y + info_font->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);