WARNING : this is the documentation for an old version of SFML. The documentation for the latest official release is available through the main menu.
WARNING : this is the documentation for an old version of SFML. The documentation for the latest official release is available through the main menu.
Simple wrapper for sf::Window that allows easy 2D rendering. More...
#include <RenderWindow.hpp>
Inheritance diagram for sf::RenderWindow:Public Member Functions | |
| RenderWindow () | |
| Default constructor. | |
| RenderWindow (VideoMode Mode, const std::string &Title, unsigned long WindowStyle=Style::Resize|Style::Close, const WindowSettings &Params=WindowSettings()) | |
| Construct the window. | |
| RenderWindow (WindowHandle Handle, const WindowSettings &Params=WindowSettings()) | |
| Construct the window from an existing control. | |
| virtual | ~RenderWindow () |
| Destructor. | |
| virtual unsigned int | GetWidth () const |
| Get the width of the rendering region of the window. | |
| virtual unsigned int | GetHeight () const |
| Get the height of the rendering region of the window. | |
| Image | Capture () const |
| Save the content of the window to an image. | |
| sf::Vector2f | ConvertCoords (unsigned int WindowX, unsigned int WindowY, const View *TargetView=NULL) const |
| Convert a point in window coordinates into view coordinates. | |
| void | Create (VideoMode Mode, const std::string &Title, unsigned long WindowStyle=Style::Resize|Style::Close, const WindowSettings &Params=WindowSettings()) |
| Create (or recreate) the window. | |
| void | Create (WindowHandle Handle, const WindowSettings &Params=WindowSettings()) |
| Create (or recreate) the window from an existing control. | |
| void | Close () |
| Close (destroy) the window. | |
| bool | IsOpened () const |
| Tell whether or not the window is opened (ie. | |
| const WindowSettings & | GetSettings () const |
| Get the creation settings of the window. | |
| bool | GetEvent (Event &EventReceived) |
| Get the event on top of events stack, if any, and pop it. | |
| void | UseVerticalSync (bool Enabled) |
| Enable / disable vertical synchronization. | |
| void | ShowMouseCursor (bool Show) |
| Show or hide the mouse cursor. | |
| void | SetCursorPosition (unsigned int Left, unsigned int Top) |
| Change the position of the mouse cursor. | |
| void | SetPosition (int Left, int Top) |
| Change the position of the window on screen. | |
| void | SetSize (unsigned int Width, unsigned int Height) |
| Change the size of the rendering region of the window. | |
| void | Show (bool State) |
| Show or hide the window. | |
| void | EnableKeyRepeat (bool Enabled) |
| Enable or disable automatic key-repeat. | |
| void | SetIcon (unsigned int Width, unsigned int Height, const Uint8 *Pixels) |
| Change the window's icon. | |
| bool | SetActive (bool Active=true) const |
| Activate of deactivate the window as the current target for rendering. | |
| void | Display () |
| Display the window on screen. | |
| const Input & | GetInput () const |
| Get the input manager of the window. | |
| void | SetFramerateLimit (unsigned int Limit) |
| Limit the framerate to a maximum fixed frequency. | |
| float | GetFrameTime () const |
| Get time elapsed since last frame. | |
| void | SetJoystickThreshold (float Threshold) |
| Change the joystick threshold, ie. | |
| void | Clear (const Color &FillColor=Color(0, 0, 0)) |
| Clear the entire target with a single color. | |
| virtual void | Draw (const Drawable &Object) |
| Draw something into the target. | |
| void | SetView (const View &NewView) |
| Change the current active view. | |
| const View & | GetView () const |
| Get the current view. | |
| View & | GetDefaultView () |
| Get the default view of the window for read / write. | |
| void | PreserveOpenGLStates (bool Preserve) |
| Tell SFML to preserve external OpenGL states, at the expense of more CPU charge. | |
Protected Member Functions | |
| void | Initialize () |
| Called by the derived class when it's ready to be initialized. | |
Simple wrapper for sf::Window that allows easy 2D rendering.
Definition at line 45 of file RenderWindow.hpp.
| sf::RenderWindow::RenderWindow | ( | ) |
Default constructor.
| 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 (Resize | Close by default) |
| Params | : Creation parameters (see default constructor for default values) |
| 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) |
| virtual sf::RenderWindow::~RenderWindow | ( | ) | [virtual] |
Destructor.
| Image sf::RenderWindow::Capture | ( | ) | const |
Save the content of the window to an image.
Clear the entire target with a single color.
| FillColor | : Color to use to clear the render target |
| void sf::Window::Close | ( | ) | [inherited] |
Close (destroy) the window.
The sf::Window instance remains valid and you can call Create to recreate the window
| 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) |
| void sf::Window::Create | ( | VideoMode | Mode, |
| const std::string & | Title, | ||
| unsigned long | WindowStyle = Style::Resize|Style::Close, |
||
| const WindowSettings & | Params = WindowSettings() |
||
| ) | [inherited] |
Create (or recreate) the window.
| Mode | : Video mode to use |
| Title | : Title of the window |
| WindowStyle | : Window style (Resize | Close by default) |
| Params | : Creation parameters (see default constructor for default values) |
| void sf::Window::Create | ( | WindowHandle | Handle, |
| const WindowSettings & | Params = WindowSettings() |
||
| ) | [inherited] |
Create (or recreate) the window from an existing control.
| Handle | : Platform-specific handle of the control |
| Params | : Creation parameters (see default constructor for default values) |
| void sf::Window::Display | ( | ) | [inherited] |
Display the window on screen.
| virtual void sf::RenderTarget::Draw | ( | const Drawable & | Object | ) | [virtual, inherited] |
Draw something into the target.
| Object | : Object to draw |
| void sf::Window::EnableKeyRepeat | ( | bool | Enabled | ) | [inherited] |
Enable or disable automatic key-repeat.
Automatic key-repeat is enabled by default
| Enabled | : True to enable, false to disable |
| View& sf::RenderTarget::GetDefaultView | ( | ) | [inherited] |
Get the default view of the window for read / write.
| bool sf::Window::GetEvent | ( | Event & | EventReceived | ) | [inherited] |
Get the event on top of events stack, if any, and pop it.
| EventReceived | : Event to fill, if any |
| float sf::Window::GetFrameTime | ( | ) | const [inherited] |
Get time elapsed since last frame.
| virtual unsigned int sf::RenderWindow::GetHeight | ( | ) | const [virtual] |
Get the height of the rendering region of the window.
Implements sf::RenderTarget.
| const Input& sf::Window::GetInput | ( | ) | const [inherited] |
Get the input manager of the window.
| const WindowSettings& sf::Window::GetSettings | ( | ) | const [inherited] |
Get the creation settings of the window.
| const View& sf::RenderTarget::GetView | ( | ) | const [inherited] |
Get the current view.
| virtual unsigned int sf::RenderWindow::GetWidth | ( | ) | const [virtual] |
Get the width of the rendering region of the window.
Implements sf::RenderTarget.
| void sf::RenderTarget::Initialize | ( | ) | [protected, inherited] |
Called by the derived class when it's ready to be initialized.
| bool sf::Window::IsOpened | ( | ) | const [inherited] |
Tell whether or not the window is opened (ie.
has been created). Note that a hidden window (Show(false)) will still return true
| void sf::RenderTarget::PreserveOpenGLStates | ( | bool | Preserve | ) | [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 |
| bool sf::Window::SetActive | ( | bool | Active = true | ) | const [inherited] |
Activate of deactivate the window as the current target for rendering.
| Active | : True to activate, false to deactivate (true by default) |
| void sf::Window::SetCursorPosition | ( | unsigned int | Left, |
| unsigned int | Top | ||
| ) | [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 |
| void sf::Window::SetFramerateLimit | ( | unsigned int | Limit | ) | [inherited] |
Limit the framerate to a maximum fixed frequency.
| Limit | : Framerate limit, in frames per seconds (use 0 to disable limit) |
| void sf::Window::SetIcon | ( | unsigned int | Width, |
| unsigned int | Height, | ||
| const Uint8 * | Pixels | ||
| ) | [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 |
| void sf::Window::SetJoystickThreshold | ( | float | Threshold | ) | [inherited] |
Change the joystick threshold, ie.
the value below which no move event will be generated
| Threshold | : New threshold, in range [0, 100] |
| void sf::Window::SetPosition | ( | int | Left, |
| int | Top | ||
| ) | [inherited] |
Change the position of the window on screen.
Only works for top-level windows
| Left | : Left position |
| Top | : Top position |
| void sf::Window::SetSize | ( | unsigned int | Width, |
| unsigned int | Height | ||
| ) | [inherited] |
Change the size of the rendering region of the window.
| Width | : New width |
| Height | : New height |
| void sf::RenderTarget::SetView | ( | const View & | NewView | ) | [inherited] |
Change the current active view.
| NewView | : New view to use (pass GetDefaultView() to set the default view) |
| void sf::Window::Show | ( | bool | State | ) | [inherited] |
Show or hide the window.
| State | : True to show, false to hide |
| void sf::Window::ShowMouseCursor | ( | bool | Show | ) | [inherited] |
Show or hide the mouse cursor.
| Show | : True to show, false to hide |
| void sf::Window::UseVerticalSync | ( | bool | Enabled | ) | [inherited] |
Enable / disable vertical synchronization.
| Enabled | : True to enable v-sync, false to deactivate |