OpenXcom  1.0
Open-source clone of the original X-Com
WarningMessage.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include "../Engine/Surface.h"
21 
22 namespace OpenXcom
23 {
24 
25 class Text;
26 class Timer;
27 class Font;
28 
33 class WarningMessage : public Surface
34 {
35 private:
36  Text *_text;
37  Timer *_timer;
38  Uint8 _color, _fade;
39 public:
41  WarningMessage(int width, int height, int x = 0, int y = 0);
45  void setColor(Uint8 color);
47  void setTextColor(Uint8 color);
49  void initText(Font *big, Font *small, Language *lang);
51  void setPalette(SDL_Color *colors, int firstcolor = 0, int ncolors = 256);
53  void showMessage(const std::string &msg);
55  void think();
57  void fade();
59  void draw();
60 };
61 
62 }
void fade()
Fades the message.
Definition: WarningMessage.cpp:126
void setPalette(SDL_Color *colors, int firstcolor=0, int ncolors=256)
Sets the warning message&#39;s palette.
Definition: WarningMessage.cpp:96
WarningMessage(int width, int height, int x=0, int y=0)
Creates a new warning message with the specified size and position.
Definition: WarningMessage.cpp:35
Timer used to run code in fixed intervals.
Definition: Timer.h:35
Text string displayed on screen.
Definition: Text.h:40
~WarningMessage()
Cleans up the warning message.
Definition: WarningMessage.cpp:52
Contains strings used throughout the game for localization.
Definition: Language.h:39
Takes care of loading and storing each character in a sprite font.
Definition: Font.h:46
void think()
Handles the timers.
Definition: WarningMessage.cpp:118
void setTextColor(Uint8 color)
Sets the text color for the warning message.
Definition: WarningMessage.cpp:71
Coloured box with text inside that fades out after it is displayed.
Definition: WarningMessage.h:33
void initText(Font *big, Font *small, Language *lang)
Initializes the warning message&#39;s resources.
Definition: WarningMessage.cpp:85
Element that is blit (rendered) onto the screen.
Definition: Surface.h:38
void draw()
Draws the message.
Definition: WarningMessage.cpp:140
void setColor(Uint8 color)
Sets the color for the warning message.
Definition: WarningMessage.cpp:62
void showMessage(const std::string &msg)
Shows the warning message.
Definition: WarningMessage.cpp:106
Definition: BaseInfoState.cpp:40