Debian Codegraph @

src/level/StatusDisplay.cpp

raw
1 /*
2 * Copyright (C) 2004 Ivo Danihelka ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9 #include "StatusDisplay.h"
10
11 #include "Picture.h"
12
13 //-----------------------------------------------------------------
14 StatusDisplay::StatusDisplay()
15 {
16 m_picture = NULL;
17 m_time = 0;
18 }
19 //-----------------------------------------------------------------
20 StatusDisplay::~StatusDisplay()
21 {
22 if (m_picture) {
23 delete m_picture;
24 }
25 }
26 //-----------------------------------------------------------------
27 /**
28 * Dislay this picture the given number of times.
29 */
30 void
31 StatusDisplay::displayStatus(Picture *new_picture, int time)
32 {
33 if (m_picture) {
34 delete m_picture;
35 }
36 m_picture = new_picture;
37 m_time = time;
38 }
39 //-----------------------------------------------------------------
40 void
41 StatusDisplay::drawOn(SDL_Surface *screen)
42 {
43 if (m_time > 0) {
44 m_time--;
45 if (m_picture) {
46 m_picture->drawOn(screen);
47 }
48 }
49 }
50