OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Window.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_WINDOW_H
20 #define OPENXCOM_WINDOW_H
21 
22 #include "../Engine/Surface.h"
23 
24 namespace OpenXcom
25 {
26 
27 class Timer;
28 class State;
29 class Sound;
30 
34 enum WindowPopup { POPUP_NONE, POPUP_HORIZONTAL, POPUP_VERTICAL, POPUP_BOTH };
35 
42 class Window : public Surface
43 {
44 private:
45  static const double POPUP_SPEED;
46  int _dx, _dy;
47  Surface *_bg;
48  Uint8 _color;
49  WindowPopup _popup;
50  double _popupStep;
51  Timer *_timer;
52  State *_state;
53  bool _contrast, _screen, _thinBorder;
54 public:
55  static Sound *soundPopup[3];
57  Window(State *state, int width, int height, int x = 0, int y = 0, WindowPopup popup = POPUP_NONE);
59  ~Window();
61  void setBackground(Surface *bg);
63  void setColor(Uint8 color);
65  Uint8 getColor() const;
67  void setHighContrast(bool contrast);
69  void think();
71  void popup();
73  void draw();
75  void setDX(int dx);
77  void setDY(int dy);
79  void setThinBorder();
80 };
81 
82 }
83 
84 #endif
A game state that receives user input and reacts accordingly.
Definition: State.h:44
Box with a coloured border and custom background.
Definition: Window.h:42
Window(State *state, int width, int height, int x=0, int y=0, WindowPopup popup=POPUP_NONE)
Creates a new window with the specified size and position.
Definition: Window.cpp:42
Timer used to run code in fixed intervals.
Definition: Timer.h:37
void setColor(Uint8 color)
Sets the border color.
Definition: Window.cpp:86
Container for sound effects.
Definition: Sound.h:32
void setDY(int dy)
sets the Y delta.
Definition: Window.cpp:277
void draw()
Draws the window.
Definition: Window.cpp:162
void think()
Handles the timers.
Definition: Window.cpp:115
void setBackground(Surface *bg)
Sets the background surface.
Definition: Window.cpp:76
WindowPopup
Enumeration for the type of animation when a window pops up.
Definition: Window.h:34
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
void popup()
Popups the window.
Definition: Window.cpp:129
~Window()
Cleans up the window.
Definition: Window.cpp:67
void setHighContrast(bool contrast)
Sets the high contrast color setting.
Definition: Window.cpp:106
void setDX(int dx)
sets the X delta.
Definition: Window.cpp:268
Uint8 getColor() const
Gets the border color.
Definition: Window.cpp:96
void setThinBorder()
Give this window a thin border.
Definition: Window.cpp:285