OpenXcom  1.0
Open-source clone of the original X-Com
Window.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 Timer;
26 class State;
27 class Sound;
28 
32 enum WindowPopup { POPUP_NONE, POPUP_HORIZONTAL, POPUP_VERTICAL, POPUP_BOTH };
33 
40 class Window : public Surface
41 {
42 private:
43  static const double POPUP_SPEED;
44  int _dx, _dy;
45  Surface *_bg;
46  Uint8 _color;
47  WindowPopup _popup;
48  double _popupStep;
49  Timer *_timer;
50  State *_state;
51  bool _contrast, _screen, _thinBorder;
52 public:
53  static Sound *soundPopup[3];
55  Window(State *state, int width, int height, int x = 0, int y = 0, WindowPopup popup = POPUP_NONE);
57  ~Window();
59  void setBackground(Surface *bg);
61  void setColor(Uint8 color);
63  Uint8 getColor() const;
65  void setHighContrast(bool contrast);
67  void think();
69  void popup();
71  void draw();
73  void setDX(int dx);
75  void setDY(int dy);
77  void setThinBorder();
78 };
79 
80 }
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:40
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:43
Timer used to run code in fixed intervals.
Definition: Timer.h:35
void setColor(Uint8 color)
Sets the border color.
Definition: Window.cpp:87
Container for sound effects.
Definition: Sound.h:30
void setDY(int dy)
sets the Y delta.
Definition: Window.cpp:278
void draw()
Draws the window.
Definition: Window.cpp:163
void think()
Handles the timers.
Definition: Window.cpp:116
void setBackground(Surface *bg)
Sets the background surface.
Definition: Window.cpp:77
Element that is blit (rendered) onto the screen.
Definition: Surface.h:38
Uint8 getColor() const
Gets the border color.
Definition: Window.cpp:97
void popup()
Popups the window.
Definition: Window.cpp:130
~Window()
Cleans up the window.
Definition: Window.cpp:68
void setHighContrast(bool contrast)
Sets the high contrast color setting.
Definition: Window.cpp:107
void setDX(int dx)
sets the X delta.
Definition: Window.cpp:269
void setThinBorder()
Give this window a thin border.
Definition: Window.cpp:286
Definition: BaseInfoState.cpp:40