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_RENDERWINDOW_HPP
\r
26 #define SFML_RENDERWINDOW_HPP
\r
28 ////////////////////////////////////////////////////////////
\r
30 ////////////////////////////////////////////////////////////
\r
31 #include <SFML/Graphics/Image.hpp>
\r
32 #include <SFML/Graphics/RenderTarget.hpp>
\r
33 #include <SFML/Window/Window.hpp>
\r
41 ////////////////////////////////////////////////////////////
\r
42 /// Simple wrapper for sf::Window that allows easy
\r
44 ////////////////////////////////////////////////////////////
\r
45 class SFML_API RenderWindow : public Window, public RenderTarget
\r
49 ////////////////////////////////////////////////////////////
\r
50 /// Default constructor
\r
52 ////////////////////////////////////////////////////////////
\r
55 ////////////////////////////////////////////////////////////
\r
56 /// Construct the window
\r
58 /// \param Mode : Video mode to use
\r
59 /// \param Title : Title of the window
\r
60 /// \param WindowStyle : Window style, see sf::Style (Resize | Close by default)
\r
61 /// \param Params : Creation parameters (see default constructor for default values)
\r
63 ////////////////////////////////////////////////////////////
\r
64 RenderWindow(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const WindowSettings& Params = WindowSettings());
\r
66 ////////////////////////////////////////////////////////////
\r
67 /// Construct the window from an existing control
\r
69 /// \param Handle : Platform-specific handle of the control
\r
70 /// \param Params : Creation parameters (see default constructor for default values)
\r
72 ////////////////////////////////////////////////////////////
\r
73 RenderWindow(WindowHandle Handle, const WindowSettings& Params = WindowSettings());
\r
75 ////////////////////////////////////////////////////////////
\r
78 ////////////////////////////////////////////////////////////
\r
79 virtual ~RenderWindow();
\r
81 ////////////////////////////////////////////////////////////
\r
82 /// Get the width of the rendering region of the window
\r
84 /// \return Width in pixels
\r
86 ////////////////////////////////////////////////////////////
\r
87 virtual unsigned int GetWidth() const;
\r
89 ////////////////////////////////////////////////////////////
\r
90 /// Get the height of the rendering region of the window
\r
92 /// \return Height in pixels
\r
94 ////////////////////////////////////////////////////////////
\r
95 virtual unsigned int GetHeight() const;
\r
97 ////////////////////////////////////////////////////////////
\r
98 /// Save the content of the window to an image
\r
100 /// \return Image instance containing the contents of the screen
\r
102 ////////////////////////////////////////////////////////////
\r
103 Image Capture() const;
\r
105 ////////////////////////////////////////////////////////////
\r
106 /// Convert a point in window coordinates into view coordinates
\r
108 /// \param WindowX : X coordinate of the point to convert, relative to the window
\r
109 /// \param WindowY : Y coordinate of the point to convert, relative to the window
\r
110 /// \param TargetView : Target view to convert the point to (NULL by default -- uses the current view)
\r
112 /// \return Converted point
\r
114 ////////////////////////////////////////////////////////////
\r
115 sf::Vector2f ConvertCoords(unsigned int WindowX, unsigned int WindowY, const View* TargetView = NULL) const;
\r
119 ////////////////////////////////////////////////////////////
\r
120 /// /see Window::OnCreate
\r
122 ////////////////////////////////////////////////////////////
\r
123 virtual void OnCreate();
\r
125 ////////////////////////////////////////////////////////////
\r
126 /// /see RenderTarget::Activate
\r
128 ////////////////////////////////////////////////////////////
\r
129 virtual bool Activate(bool Active);
\r
135 #endif // SFML_RENDERWINDOW_HPP
\r