Simple wrapper for sf::Window that allows easy 2D rendering. More...
#include <RenderWindow.hpp>
Public Member Functions | |
RenderWindow () | |
Default constructor. More... | |
RenderWindow (VideoMode Mode, const std::string &Title, unsigned long WindowStyle=Style::Resize|Style::Close, const WindowSettings &Params=WindowSettings()) | |
Construct the window. More... | |
RenderWindow (WindowHandle Handle, const WindowSettings &Params=WindowSettings()) | |
Construct the window from an existing control. More... | |
virtual | ~RenderWindow () |
Destructor. More... | |
virtual unsigned int | GetWidth () const |
Get the width of the rendering region of the window. More... | |
virtual unsigned int | GetHeight () const |
Get the height of the rendering region of the window. More... | |
Image | Capture () const |
Save the content of the window to an image. More... | |
sf::Vector2f | ConvertCoords (unsigned int WindowX, unsigned int WindowY, const View *TargetView=NULL) const |
Convert a point in window coordinates into view coordinates. More... | |
void | Create (VideoMode Mode, const std::string &Title, unsigned long WindowStyle=Style::Resize|Style::Close, const WindowSettings &Params=WindowSettings()) |
Create (or recreate) the window. More... | |
void | Create (WindowHandle Handle, const WindowSettings &Params=WindowSettings()) |
Create (or recreate) the window from an existing control. More... | |
void | Close () |
Close (destroy) the window. More... | |
bool | IsOpened () const |
Tell whether or not the window is opened (ie. More... | |
const WindowSettings & | GetSettings () const |
Get the creation settings of the window. More... | |
bool | GetEvent (Event &EventReceived) |
Get the event on top of events stack, if any, and pop it. More... | |
void | UseVerticalSync (bool Enabled) |
Enable / disable vertical synchronization. More... | |
void | ShowMouseCursor (bool Show) |
Show or hide the mouse cursor. More... | |
void | SetCursorPosition (unsigned int Left, unsigned int Top) |
Change the position of the mouse cursor. More... | |
void | SetPosition (int Left, int Top) |
Change the position of the window on screen. More... | |
void | SetSize (unsigned int Width, unsigned int Height) |
Change the size of the rendering region of the window. More... | |
void | Show (bool State) |
Show or hide the window. More... | |
void | EnableKeyRepeat (bool Enabled) |
Enable or disable automatic key-repeat. More... | |
void | SetIcon (unsigned int Width, unsigned int Height, const Uint8 *Pixels) |
Change the window's icon. More... | |
bool | SetActive (bool Active=true) const |
Activate of deactivate the window as the current target for rendering. More... | |
void | Display () |
Display the window on screen. More... | |
const Input & | GetInput () const |
Get the input manager of the window. More... | |
void | SetFramerateLimit (unsigned int Limit) |
Limit the framerate to a maximum fixed frequency. More... | |
float | GetFrameTime () const |
Get time elapsed since last frame. More... | |
void | SetJoystickThreshold (float Threshold) |
Change the joystick threshold, ie. More... | |
void | Clear (const Color &FillColor=Color(0, 0, 0)) |
Clear the entire target with a single color. More... | |
virtual void | Draw (const Drawable &Object) |
Draw something into the target. More... | |
void | SetView (const View &NewView) |
Change the current active view. More... | |
const View & | GetView () const |
Get the current view. More... | |
View & | GetDefaultView () |
Get the default view of the window for read / write. More... | |
void | PreserveOpenGLStates (bool Preserve) |
Tell SFML to preserve external OpenGL states, at the expense of more CPU charge. More... | |
Protected Member Functions | |
void | Initialize () |
Called by the derived class when it's ready to be initialized. More... | |
Simple wrapper for sf::Window that allows easy 2D rendering.
Definition at line 45 of file RenderWindow.hpp.
sf::RenderWindow::RenderWindow | ( | ) |
Default constructor.
Definition at line 40 of file RenderWindow.cpp.
sf::RenderWindow::RenderWindow | ( | VideoMode | Mode, |
const std::string & | Title, | ||
unsigned long | WindowStyle = Style::Resize | Style::Close , |
||
const WindowSettings & | Params = WindowSettings() |
||
) |
Construct the window.
Mode | : Video mode to use |
Title | : Title of the window |
WindowStyle | : Window style, see sf::Style (Resize | Close by default) |
Params | : Creation parameters (see default constructor for default values) |
Definition at line 49 of file RenderWindow.cpp.
sf::RenderWindow::RenderWindow | ( | WindowHandle | Handle, |
const WindowSettings & | Params = WindowSettings() |
||
) |
Construct the window from an existing control.
Handle | : Platform-specific handle of the control |
Params | : Creation parameters (see default constructor for default values) |
Definition at line 58 of file RenderWindow.cpp.
|
virtual |
Destructor.
Definition at line 67 of file RenderWindow.cpp.
Image sf::RenderWindow::Capture | ( | ) | const |
Save the content of the window to an image.
Definition at line 107 of file RenderWindow.cpp.
Clear the entire target with a single color.
FillColor | : Color to use to clear the render target |
Definition at line 60 of file RenderTarget.cpp.
|
inherited |
Close (destroy) the window.
The sf::Window instance remains valid and you can call Create to recreate the window
Definition at line 165 of file Window.cpp.
sf::Vector2f sf::RenderWindow::ConvertCoords | ( | unsigned int | WindowX, |
unsigned int | WindowY, | ||
const View * | TargetView = NULL |
||
) | const |
Convert a point in window coordinates into view coordinates.
WindowX | : X coordinate of the point to convert, relative to the window |
WindowY | : Y coordinate of the point to convert, relative to the window |
TargetView | : Target view to convert the point to (NULL by default – uses the current view) |
Definition at line 142 of file RenderWindow.cpp.
|
inherited |
Create (or recreate) the window.
Create the window.
Mode | : Video mode to use |
Title | : Title of the window |
WindowStyle | : Window style, see sf::Style (Resize | Close by default) |
Params | : Creation parameters (see default constructor for default values) |
Definition at line 104 of file Window.cpp.
|
inherited |
Create (or recreate) the window from an existing control.
Create the window from an existing control.
Handle | : Platform-specific handle of the control |
Params | : Creation parameters (see default constructor for default values) |
Definition at line 147 of file Window.cpp.
|
inherited |
Display the window on screen.
Definition at line 353 of file Window.cpp.
|
virtualinherited |
Draw something into the target.
Draw something on the window.
Object | : Object to draw |
Definition at line 76 of file RenderTarget.cpp.
|
inherited |
Enable or disable automatic key-repeat.
Automatic key-repeat is enabled by default
Enabled | : True to enable, false to disable |
Automatic key-repeat is enabled by default
Definition at line 317 of file Window.cpp.
|
inherited |
Get the default view of the window for read / write.
Definition at line 147 of file RenderTarget.cpp.
|
inherited |
Get the event on top of events stack, if any, and pop it.
Get the event on top of events stack, if any.
EventReceived | : Event to fill, if any |
Definition at line 218 of file Window.cpp.
|
inherited |
Get time elapsed since last frame.
Definition at line 394 of file Window.cpp.
|
virtual |
Get the height of the rendering region of the window.
Implements sf::RenderTarget.
Definition at line 98 of file RenderWindow.cpp.
|
inherited |
Get the input manager of the window.
Definition at line 376 of file Window.cpp.
|
inherited |
Get the creation settings of the window.
Definition at line 209 of file Window.cpp.
|
inherited |
Get the current view.
Definition at line 138 of file RenderTarget.cpp.
|
virtual |
Get the width of the rendering region of the window.
Implements sf::RenderTarget.
Definition at line 89 of file RenderWindow.cpp.
|
protectedinherited |
Called by the derived class when it's ready to be initialized.
Definition at line 170 of file RenderTarget.cpp.
|
inherited |
Tell whether or not the window is opened (ie.
has been created). Note that a hidden window (Show(false)) will still return true
has been created). Note that a hidden window (Show(false)) will still return true
Definition at line 182 of file Window.cpp.
|
inherited |
Tell SFML to preserve external OpenGL states, at the expense of more CPU charge.
Use this function if you don't want SFML to mess up your own OpenGL states (if any). Don't enable state preservation if not needed, as it will allow SFML to do internal optimizations and improve performances. This parameter is false by default
Preserve | : True to preserve OpenGL states, false to let SFML optimize |
Use this function if you don't want SFML to mess up your own OpenGL states (if any). Don't enable state preservation if not needed, as it will allow SFML to do internal optimizations and improve performances. This parameter is false by default
Definition at line 161 of file RenderTarget.cpp.
|
inherited |
Activate of deactivate the window as the current target for rendering.
Active | : True to activate, false to deactivate (true by default) |
Definition at line 338 of file Window.cpp.
|
inherited |
Change the position of the mouse cursor.
Left | : Left coordinate of the cursor, relative to the window |
Top | : Top coordinate of the cursor, relative to the window |
Definition at line 260 of file Window.cpp.
|
inherited |
Limit the framerate to a maximum fixed frequency.
Set the framerate at a fixed frequency.
Limit | : Framerate limit, in frames per seconds (use 0 to disable limit) |
Definition at line 385 of file Window.cpp.
|
inherited |
Change the window's icon.
Width | : Icon's width, in pixels |
Height | : Icon's height, in pixels |
Pixels | : Pointer to the pixels in memory, format must be RGBA 32 bits |
Definition at line 327 of file Window.cpp.
|
inherited |
Change the joystick threshold, ie.
the value below which no move event will be generated
Threshold | : New threshold, in range [0, 100] |
the value below which no move event will be generated
Definition at line 404 of file Window.cpp.
|
inherited |
Change the position of the window on screen.
Only works for top-level windows
Left | : Left position |
Top | : Top position |
Definition at line 276 of file Window.cpp.
|
inherited |
Change the size of the rendering region of the window.
Width | : New width |
Height | : New height |
Definition at line 293 of file Window.cpp.
|
inherited |
Change the current active view.
NewView | : New view to use (pass GetDefaultView() to set the default view) |
Definition at line 129 of file RenderTarget.cpp.
|
inherited |
Show or hide the window.
State | : True to show, false to hide |
Definition at line 303 of file Window.cpp.
|
inherited |
Show or hide the mouse cursor.
Show | : True to show, false to hide |
Definition at line 250 of file Window.cpp.
|
inherited |
Enable / disable vertical synchronization.
Enabled | : True to enable v-sync, false to deactivate |
Definition at line 240 of file Window.cpp.