/**\brief Lazy fetch an Font */ Font* Font::GetSkin( string skinPath ) { string path = SKIN( skinPath ); if( path == "" ) { LogMsg(DEBUG1,"Couldn't Find Font '%s'",skinPath.c_str()); assert(0); } return Get( path ); }
StatusBar::StatusBar(string _title, int _width, QuadPosition _pos, string _updater) :width(_width) ,pos(_pos) ,ratio(0) { strncpy(title,_title.c_str(),sizeof(title)); title[sizeof(title)-1] = '\0'; memset( name, '\0', sizeof(name) ); lua_updater = _updater; LogMsg (DEBUG, "Creating a new StatusBar '%s' : Name(%s) / Ratio( %f)\n", title, name, ratio); assert(pos >= 0); assert(pos <= 4); if( font == NULL ) { font = Font::Get( SKIN("Skin/HUD/StatusBar/Font"), convertTo<int>(SKIN("Skin/HUD/StatusBar/Size")) ); font->SetColor( SKIN("Skin/HUD/StatusBar/Color") ); } }
/**\brief This is used to construct the Textbox.*/ Textbox::Textbox( int x, int y, int w, int rows, string text, string label ) { int rowHeight; if ( font == NULL ) { font = new Font( SKIN( "Skin/UI/Textbox/Font" ) ); foreground = Color( SKIN( "Skin/UI/Textbox/Color/Foreground" ) ); background = Color( SKIN( "Skin/UI/Textbox/Color/Background" ) ); edge = Color( SKIN( "Skin/UI/Textbox/Color/Edge" ) ); } rowHeight = ((font->LineHeight()+9)/10)*10; // Round the rowHeight up to the nearest 10 pixels rowPad = (rowHeight - font->LineHeight()) / 2; // Pad the text to center it in the row this->x = x; this->y = y; this->w = w; this->h = rows * rowHeight; this->name = label; this->text = text; }
/**\brief Creates a new dropdown with specified parameters. */ Dropdown::Dropdown( int x, int y, int w, int _baseheight ) { // TODO The Dropdowns really need their own Art. bitmap_normal = Image::Get( "Resources/Skin/ui_dropdown_closed.png" ); bitmap_open = Image::Get( "Resources/Skin/ui_dropdown_open.png" ); bitmap_mouseover = Image::Get( "Resources/Skin/ui_dropdown_mouseover.png" ); bitmap_selected = Image::Get( "Resources/Skin/ui_dropdown_selected.png" ); this->x = x; this->y = y; this->w = w; this->h = _baseheight; baseheight = _baseheight; xoffset = convertTo<int>( SKIN("Skin/UI/Dropdown/XOffset")); yoffset = convertTo<int>( SKIN("Skin/UI/Dropdown/YOffset")); opened = false; hovered = -1; selected = -1; }
void Hud::Init( void ) { AlertFont = new Font( SKIN("Skin/HUD/Alert/Font"), convertTo<int>( SKIN("Skin/HUD/Alert/Size") ) ); AlertColor = Color( SKIN("Skin/HUD/Alert/Color") ); AlertBeep = Sound::Get( "data/audio/interface/hud_beep.ogg" ); }