1 ////////////////////////////////////////////////////////////
\r
3 // SFML - Simple and Fast Multimedia Library
\r
4 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
\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
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
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
18 // 2. Altered source versions must be plainly marked as such,
\r
19 // and must not be misrepresented as being the original software.
\r
21 // 3. This notice may not be removed or altered from any source distribution.
\r
23 ////////////////////////////////////////////////////////////
\r
25 #ifndef SFML_VIDEOMODE_HPP
\r
26 #define SFML_VIDEOMODE_HPP
\r
28 ////////////////////////////////////////////////////////////
\r
30 ////////////////////////////////////////////////////////////
\r
31 #include <SFML/Config.hpp>
\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
46 ////////////////////////////////////////////////////////////
\r
47 /// Default constructor
\r
49 ////////////////////////////////////////////////////////////
\r
52 ////////////////////////////////////////////////////////////
\r
53 /// Construct the video mode with its attributes
\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
59 ////////////////////////////////////////////////////////////
\r
60 VideoMode(unsigned int ModeWidth, unsigned int ModeHeight, unsigned int ModeBpp = 32);
\r
62 ////////////////////////////////////////////////////////////
\r
63 /// Get the current desktop video mode
\r
65 /// \return Current desktop video mode
\r
67 ////////////////////////////////////////////////////////////
\r
68 static VideoMode GetDesktopMode();
\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
75 /// \param Index : Index of video mode to get
\r
77 /// \return Corresponding video mode (invalid mode if index is out of range)
\r
79 ////////////////////////////////////////////////////////////
\r
80 static VideoMode GetMode(std::size_t Index);
\r
82 ////////////////////////////////////////////////////////////
\r
83 /// Get valid video modes count
\r
85 /// \return Number of valid video modes available
\r
87 ////////////////////////////////////////////////////////////
\r
88 static std::size_t GetModesCount();
\r
90 ////////////////////////////////////////////////////////////
\r
91 /// Tell whether or not the video mode is supported
\r
93 /// \return True if video mode is supported, false otherwise
\r
95 ////////////////////////////////////////////////////////////
\r
96 bool IsValid() const;
\r
98 ////////////////////////////////////////////////////////////
\r
99 /// Comparison operator overload -- tell if two video modes are equal
\r
101 /// \param Other : Video mode to compare
\r
103 /// \return True if modes are equal
\r
105 ////////////////////////////////////////////////////////////
\r
106 bool operator ==(const VideoMode& Other) const;
\r
108 ////////////////////////////////////////////////////////////
\r
109 /// Comparison operator overload -- tell if two video modes are different
\r
111 /// \param Other : Video mode to compare
\r
113 /// \return True if modes are different
\r
115 ////////////////////////////////////////////////////////////
\r
116 bool operator !=(const VideoMode& Other) const;
\r
118 ////////////////////////////////////////////////////////////
\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
127 ////////////////////////////////////////////////////////////
\r
128 /// Get and sort valid video modes
\r
129 ////////////////////////////////////////////////////////////
\r
130 static void InitializeModes();
\r
136 #endif // SFML_VIDEOMODE_HPP
\r