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 "StatusDisplay.h" 00010 00011 #include "Picture.h" 00012 00013 //----------------------------------------------------------------- 00014 StatusDisplay::StatusDisplay() 00015 { 00016 m_picture = NULL; 00017 m_time = 0; 00018 } 00019 //----------------------------------------------------------------- 00020 StatusDisplay::~StatusDisplay() 00021 { 00022 if (m_picture) { 00023 delete m_picture; 00024 } 00025 } 00026 //----------------------------------------------------------------- 00027 /** 00028 * Dislay this picture given number of times. 00029 */ 00030 void 00031 StatusDisplay::displayStatus(Picture *new_picture, int time) 00032 { 00033 if (m_picture) { 00034 delete m_picture; 00035 } 00036 m_picture = new_picture; 00037 m_time = time; 00038 } 00039 //----------------------------------------------------------------- 00040 void 00041 StatusDisplay::drawOn(SDL_Surface *screen) 00042 { 00043 if (m_time > 0) { 00044 m_time--; 00045 if (m_picture) { 00046 m_picture->drawOn(screen); 00047 } 00048 } 00049 } 00050