00001 /* 00002 * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net) 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 */ 00009 #include "WiStatusBar.h" 00010 00011 #include "Font.h" 00012 00013 //----------------------------------------------------------------- 00014 WiStatusBar::WiStatusBar(Font *new_font, const SDL_Color &color, int width) 00015 : m_color(color) 00016 { 00017 m_font = new_font; 00018 m_w = width; 00019 } 00020 //----------------------------------------------------------------- 00021 WiStatusBar::~WiStatusBar() 00022 { 00023 delete m_font; 00024 } 00025 //----------------------------------------------------------------- 00026 int 00027 WiStatusBar::getH() const 00028 { 00029 return m_font->getHeight(); 00030 } 00031 //----------------------------------------------------------------- 00032 void 00033 WiStatusBar::drawOn(SDL_Surface *screen) 00034 { 00035 if (!m_label.empty()) { 00036 SDL_Rect rect; 00037 rect.x = m_shift.getX(); 00038 rect.y = m_shift.getY(); 00039 00040 SDL_Surface *rendered = m_font->renderTextOutlined(m_label, m_color); 00041 SDL_BlitSurface(rendered, NULL, screen, &rect); 00042 SDL_FreeSurface(rendered); 00043 } 00044 } 00045