]> git.sesse.net Git - casparcg/blob - SFML-1.6/include/SFML/Window/VideoMode.hpp
(no commit message)
[casparcg] / SFML-1.6 / include / SFML / Window / VideoMode.hpp
1 ////////////////////////////////////////////////////////////\r
2 //\r
3 // SFML - Simple and Fast Multimedia Library\r
4 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)\r
5 //\r
6 // This software is provided 'as-is', without any express or implied warranty.\r
7 // In no event will the authors be held liable for any damages arising from the use of this software.\r
8 //\r
9 // Permission is granted to anyone to use this software for any purpose,\r
10 // including commercial applications, and to alter it and redistribute it freely,\r
11 // subject to the following restrictions:\r
12 //\r
13 // 1. The origin of this software must not be misrepresented;\r
14 //    you must not claim that you wrote the original software.\r
15 //    If you use this software in a product, an acknowledgment\r
16 //    in the product documentation would be appreciated but is not required.\r
17 //\r
18 // 2. Altered source versions must be plainly marked as such,\r
19 //    and must not be misrepresented as being the original software.\r
20 //\r
21 // 3. This notice may not be removed or altered from any source distribution.\r
22 //\r
23 ////////////////////////////////////////////////////////////\r
24 \r
25 #ifndef SFML_VIDEOMODE_HPP\r
26 #define SFML_VIDEOMODE_HPP\r
27 \r
28 ////////////////////////////////////////////////////////////\r
29 // Headers\r
30 ////////////////////////////////////////////////////////////\r
31 #include <SFML/Config.hpp>\r
32 #include <cstdlib>\r
33 \r
34 \r
35 namespace sf\r
36 {\r
37 ////////////////////////////////////////////////////////////\r
38 /// VideoMode defines a video mode (width, height, bpp, frequency)\r
39 /// and provides static functions for getting modes supported\r
40 /// by the display device\r
41 ////////////////////////////////////////////////////////////\r
42 class SFML_API VideoMode\r
43 {\r
44 public :\r
45 \r
46     ////////////////////////////////////////////////////////////\r
47     /// Default constructor\r
48     ///\r
49     ////////////////////////////////////////////////////////////\r
50     VideoMode();\r
51 \r
52     ////////////////////////////////////////////////////////////\r
53     /// Construct the video mode with its attributes\r
54     ///\r
55     /// \param ModeWidth :  Width in pixels\r
56     /// \param ModeHeight : Height in pixels\r
57     /// \param ModeBpp :    Pixel depths in bits per pixel (32 by default)\r
58     ///\r
59     ////////////////////////////////////////////////////////////\r
60     VideoMode(unsigned int ModeWidth, unsigned int ModeHeight, unsigned int ModeBpp = 32);\r
61 \r
62     ////////////////////////////////////////////////////////////\r
63     /// Get the current desktop video mode\r
64     ///\r
65     /// \return Current desktop video mode\r
66     ///\r
67     ////////////////////////////////////////////////////////////\r
68     static VideoMode GetDesktopMode();\r
69 \r
70     ////////////////////////////////////////////////////////////\r
71     /// Get a valid video mode\r
72     /// Index must be in range [0, GetModesCount()[\r
73     /// Modes are sorted from best to worst\r
74     ///\r
75     /// \param Index : Index of video mode to get\r
76     ///\r
77     /// \return Corresponding video mode (invalid mode if index is out of range)\r
78     ///\r
79     ////////////////////////////////////////////////////////////\r
80     static VideoMode GetMode(std::size_t Index);\r
81 \r
82     ////////////////////////////////////////////////////////////\r
83     /// Get valid video modes count\r
84     ///\r
85     /// \return Number of valid video modes available\r
86     ///\r
87     ////////////////////////////////////////////////////////////\r
88     static std::size_t GetModesCount();\r
89 \r
90     ////////////////////////////////////////////////////////////\r
91     /// Tell whether or not the video mode is supported\r
92     ///\r
93     /// \return True if video mode is supported, false otherwise\r
94     ///\r
95     ////////////////////////////////////////////////////////////\r
96     bool IsValid() const;\r
97 \r
98     ////////////////////////////////////////////////////////////\r
99     /// Comparison operator overload -- tell if two video modes are equal\r
100     ///\r
101     /// \param Other : Video mode to compare\r
102     ///\r
103     /// \return True if modes are equal\r
104     ///\r
105     ////////////////////////////////////////////////////////////\r
106     bool operator ==(const VideoMode& Other) const;\r
107 \r
108     ////////////////////////////////////////////////////////////\r
109     /// Comparison operator overload -- tell if two video modes are different\r
110     ///\r
111     /// \param Other : Video mode to compare\r
112     ///\r
113     /// \return True if modes are different\r
114     ///\r
115     ////////////////////////////////////////////////////////////\r
116     bool operator !=(const VideoMode& Other) const;\r
117 \r
118     ////////////////////////////////////////////////////////////\r
119     // Member data\r
120     ////////////////////////////////////////////////////////////\r
121     unsigned int Width;        ///< Video mode width, in pixels\r
122     unsigned int Height;       ///< Video mode height, in pixels\r
123     unsigned int BitsPerPixel; ///< Video mode pixel depth, in bits per pixels\r
124 \r
125 private :\r
126 \r
127     ////////////////////////////////////////////////////////////\r
128     /// Get and sort valid video modes\r
129     ////////////////////////////////////////////////////////////\r
130     static void InitializeModes();\r
131 };\r
132 \r
133 } // namespace sf\r
134 \r
135 \r
136 #endif // SFML_VIDEOMODE_HPP\r