OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Screen.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_SCREEN_H
20 #define OPENXCOM_SCREEN_H
21 
22 #include <SDL.h>
23 #include <string>
24 #include "OpenGL.h"
25 
26 namespace OpenXcom
27 {
28 
29 class Surface;
30 class Action;
31 
40 class Screen
41 {
42 private:
43  SDL_Surface *_screen;
44  int _bpp;
45  int _baseWidth, _baseHeight;
46  double _scaleX, _scaleY;
47  int _topBlackBand, _bottomBlackBand, _leftBlackBand, _rightBlackBand, _cursorTopBlackBand, _cursorLeftBlackBand;
48  Uint32 _flags;
49  int _zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst, int flipx, int flipy);
50  SDL_Color deferredPalette[256];
51  int _numColors, _firstColor;
52  bool _pushPalette;
53  OpenGL glOutput;
54  Surface *_surface;
55  SDL_Rect _clear;
57  void makeVideoFlags();
58 public:
59  static const int ORIGINAL_WIDTH;
60  static const int ORIGINAL_HEIGHT;
61 
63  Screen();
65  ~Screen();
67  int getDX();
69  int getDY();
73  void handle(Action *action);
75  void flip();
77  void clear();
79  void setPalette(SDL_Color *colors, int firstcolor = 0, int ncolors = 256, bool immediately = false);
81  SDL_Color *getPalette() const;
83  int getWidth() const;
85  int getHeight() const;
87  void resetDisplay(bool resetVideo = true);
89  double getXScale() const;
91  double getYScale() const;
93  int getCursorTopBlackBand() const;
95  int getCursorLeftBlackBand() const;
97  void screenshot(const std::string &filename) const;
99  static bool isHQXEnabled();
101  static bool isOpenGLEnabled();
103  static void updateScale(int &type, int selection, int &x, int &y, bool change);
104 };
105 
106 }
107 
108 #endif
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
void clear()
Clears the screen.
Definition: Screen.cpp:217
Screen()
Creates a new display screen.
Definition: Screen.cpp:110
int getCursorTopBlackBand() const
Gets the screen's top black forbidden to cursor band's height.
Definition: Screen.cpp:477
static bool isOpenGLEnabled()
Checks whether OpenGL output is requested.
Definition: Screen.cpp:553
static void updateScale(int &type, int selection, int &x, int &y, bool change)
update the game scale as required.
Definition: Screen.cpp:588
double getXScale() const
Gets the screen's X scale.
Definition: Screen.cpp:459
void screenshot(const std::string &filename) const
Takes a screenshot.
Definition: Screen.cpp:495
int getCursorLeftBlackBand() const
Gets the screen's left black forbidden to cursor band's width.
Definition: Screen.cpp:486
~Screen()
Cleans up the display screen.
Definition: Screen.cpp:120
SDL_Color * getPalette() const
Gets the screen's 8bpp palette.
Definition: Screen.cpp:277
void handle(Action *action)
Handles keyboard events.
Definition: Screen.cpp:140
int getDY()
Get vertical offset.
Definition: Screen.cpp:575
int getDX()
Get horizontal offset.
Definition: Screen.cpp:566
double getYScale() const
Gets the screen's Y scale.
Definition: Screen.cpp:468
int getWidth() const
Gets the screen's width.
Definition: Screen.cpp:286
static bool isHQXEnabled()
Checks whether HQX is requested and works for the selected resolution.
Definition: Screen.cpp:531
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
Definition: OpenGL.h:57
int getHeight() const
Gets the screen's height.
Definition: Screen.cpp:295
void setPalette(SDL_Color *colors, int firstcolor=0, int ncolors=256, bool immediately=false)
Sets the screen's 8bpp palette.
Definition: Screen.cpp:231
Surface * getSurface()
Gets the internal buffer.
Definition: Screen.cpp:130
A display screen, handles rendering onto the game window.
Definition: Screen.h:40
void flip()
Renders the screen onto the game window.
Definition: Screen.cpp:184
void resetDisplay(bool resetVideo=true)
Resets the screen display.
Definition: Screen.cpp:305