comparison engine/core/video/devicecaps.h @ 635:3094988564d5

* Added a simple method to query the default video card capabilities. This is still a work in progress. You can now get a list of ScreenModes the device supports. ScreenMode includes information on the screen resolution, if the mode is fullscreen/windowed and if it would use the OpenGL or SDL renderer.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Wed, 06 Oct 2010 19:19:08 +0000
parents
children f7863bfa92cd
comparison
equal deleted inserted replaced
634:5f381fa34769 635:3094988564d5
1 /***************************************************************************
2 * Copyright (C) 2005-2010 by the FIFE team *
3 * http://www.fifengine.net *
4 * This file is part of FIFE. *
5 * *
6 * FIFE is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Lesser General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2.1 of the License, or (at your option) any later version. *
10 * *
11 * This library 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 GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20 ***************************************************************************/
21
22 #ifndef FIFE_DEVICECAPS_H
23 #define FIFE_DEVICECAPS_H
24
25 // Standard C++ library includes
26 #include <string>
27 #include <vector>
28
29 // Platform specific includes
30
31 // 3rd party library includes
32
33 // FIFE includes
34 // These includes are split up in two parts, separated by one empty line
35 // First block: files included from the FIFE root src directory
36 // Second block: files included from the same folder
37
38 namespace FIFE {
39
40
41 class ScreenMode {
42 public:
43 /** Constructors.
44 */
45 ScreenMode();
46 ScreenMode(uint16_t width, uint16_t height, uint16_t bpp, uint32_t SDLFlags);
47 ScreenMode(const ScreenMode& rhs);
48
49 /** Destructor.
50 */
51 ~ScreenMode() {};
52
53 /** Returns the width of the screen mode.
54 */
55 uint16_t getWidth() const { return m_width; };
56
57 /** Returns the height of the screen mode.
58 */
59 uint16_t getHeight() const { return m_height; };
60
61 /** Returns the number of bits per pixel this mode supports.
62 */
63 uint16_t getBPP() const { return m_bpp; };
64
65 /** Returns the SDL flags used when testing this mode.
66 */
67 uint32_t getSDLFlags() const { return m_SDLFlags; };
68
69 /** True if this is a fullscreen mode. Fals if it is a windowed mode.
70 */
71 bool isFullScreen() const { return (m_SDLFlags & SDL_FULLSCREEN) ? true : false;};
72
73 /** True if this mode uses the OpenGL renderer. False otherwise.
74 */
75 bool isOpenGL() const { return (m_SDLFlags & SDL_OPENGL) ? true : false; };
76
77 private:
78 uint16_t m_width;
79 uint16_t m_height;
80 uint16_t m_bpp;
81 uint32_t m_SDLFlags;
82
83 }; //ScreenMode
84
85 class DeviceCaps {
86 public:
87 /** Constructor.
88 */
89 DeviceCaps();
90
91 /** Destructor.
92 */
93 ~DeviceCaps();
94
95 void fillDeviceCaps();
96 std::vector<ScreenMode> getSupportedScreenModes() const {return m_screenModes;} ;
97
98 private:
99 std::vector<ScreenMode> m_screenModes;
100
101 }; //DeviceCaps
102 }
103
104 #endif //FIFE_DEVICECAPS_H