sf::RenderWindow Class Reference

Simple wrapper for sf::Window that allows easy 2D rendering. More...

#include <RenderWindow.hpp>

Inheritance diagram for sf::RenderWindow:

sf::Window sf::WindowListener sf::NonCopyable List of all members.

Public Member Functions

 RenderWindow ()
 Default constructor.
 RenderWindow (VideoMode Mode, const std::string &Title, unsigned long WindowStyle=Style::Resize|Style::Close, int AntialiasingLevel=0)
 Construct the window.
 RenderWindow (WindowHandle Handle, int AntialiasingLevel=0)
 Construct the window from an existing control.
virtual ~RenderWindow ()
 Destructor.
void Draw (const Drawable &Object) const
 Draw something on the window.
Image Capture () const
 Save the content of the window to an image.
void SetBackgroundColor (const Color &Col)
 Change the background color of the window.
void SetView (const View *NewView)
 Change the current active view.
const FloatRectGetViewRect () const
 Get the current view rectangle.
void OptimizeForNonOpenGL (bool Optimize)
 Tell SFML to optimize its calls to the graphics driver, in case the user is not doing custom OpenGL calls.
void Create (VideoMode Mode, const std::string &Title, unsigned long WindowStyle=Style::Resize|Style::Close, int AntialiasingLevel=0)
 Create (or recreate) the window.
void Create (WindowHandle Handle, int AntialiasingLevel=0)
 Create (or recreate) the window from an existing control.
unsigned int GetWidth () const
 Get the width of the rendering region of the window.
unsigned int GetHeight () const
 Get the height of the rendering region of the window.
unsigned int GetDepthBits () const
 Get the depth buffer bits.
unsigned int GetStencilBits () const
 Get the stencil buffer bits.
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 Show (bool State)
 Show or hide the window.
bool SetCurrent () const
 Set the window as the current target for rendering.
void Display ()
 Display the window on screen.
const InputGetInput () 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.

Detailed Description

Simple wrapper for sf::Window that allows easy 2D rendering.

Definition at line 47 of file RenderWindow.hpp.


Constructor & Destructor Documentation

sf::RenderWindow::RenderWindow (  ) 

Default constructor.

sf::RenderWindow::RenderWindow ( VideoMode  Mode,
const std::string &  Title,
unsigned long  WindowStyle = Style::Resize|Style::Close,
int  AntialiasingLevel = 0 
)

Construct the window.

Parameters:
Mode : Video mode to use
Title : Title of the window
WindowStyle : Window style (Resize | Close by default)
AntialiasingLevel : Level of antialiasing (0 by default, disabled)

sf::RenderWindow::RenderWindow ( WindowHandle  Handle,
int  AntialiasingLevel = 0 
)

Construct the window from an existing control.

Parameters:
Handle : Platform-specific handle of the control
AntialiasingLevel : Level of antialiasing (0 by default, disabled)

virtual sf::RenderWindow::~RenderWindow (  )  [virtual]

Destructor.


Member Function Documentation

void sf::RenderWindow::Draw ( const Drawable Object  )  const

Draw something on the window.

Parameters:
Object : Object to draw

Image sf::RenderWindow::Capture (  )  const

Save the content of the window to an image.

Returns:
Image instance containing the contents of the screen

void sf::RenderWindow::SetBackgroundColor ( const Color Col  ) 

Change the background color of the window.

The default color is black

Parameters:
Col : New background color

void sf::RenderWindow::SetView ( const View NewView  ) 

Change the current active view.

The current view is defined with the initial size of the window

Parameters:
NewView : Pointer to the new view (pass NULL to set the default view)

const FloatRect& sf::RenderWindow::GetViewRect (  )  const

Get the current view rectangle.

Returns:
Current view rectangle, in global coordinates

void sf::RenderWindow::OptimizeForNonOpenGL ( bool  Optimize  ) 

Tell SFML to optimize its calls to the graphics driver, in case the user is not doing custom OpenGL calls.

This parameter is false by default

Parameters:
Optimize : True to enable internal states optimizations, false to go back to safe mode

void sf::Window::Create ( VideoMode  Mode,
const std::string &  Title,
unsigned long  WindowStyle = Style::Resize|Style::Close,
int  AntialiasingLevel = 0 
) [inherited]

Create (or recreate) the window.

Parameters:
Mode : Video mode to use
Title : Title of the window
WindowStyle : Window style (Resize | Close by default)
AntialiasingLevel : Level of antialiasing (0 by default, disabled)

void sf::Window::Create ( WindowHandle  Handle,
int  AntialiasingLevel = 0 
) [inherited]

Create (or recreate) the window from an existing control.

Parameters:
Handle : Platform-specific handle of the control
AntialiasingLevel : Level of antialiasing (0 by default, disabled)

unsigned int sf::Window::GetWidth (  )  const [inherited]

Get the width of the rendering region of the window.

Returns:
Width in pixels

unsigned int sf::Window::GetHeight (  )  const [inherited]

Get the height of the rendering region of the window.

Returns:
Height in pixels

unsigned int sf::Window::GetDepthBits (  )  const [inherited]

Get the depth buffer bits.

Returns:
Depth bits (can be 0 if there is no depth buffer)

unsigned int sf::Window::GetStencilBits (  )  const [inherited]

Get the stencil buffer bits.

Returns:
Stencil bits (can be 0 if there is no stencil buffer)

bool sf::Window::GetEvent ( Event EventReceived  )  [inherited]

Get the event on top of events stack, if any, and pop it.

Parameters:
EventReceived : Event to fill, if any
Returns:
True if an event was returned, false if events stack was empty

void sf::Window::UseVerticalSync ( bool  Enabled  )  [inherited]

Enable / disable vertical synchronization.

Parameters:
Enabled : True to enable v-sync, false to deactivate

void sf::Window::ShowMouseCursor ( bool  Show  )  [inherited]

Show or hide the mouse cursor.

Parameters:
Show : True to show, false to hide

void sf::Window::SetCursorPosition ( unsigned int  Left,
unsigned int  Top 
) [inherited]

Change the position of the mouse cursor.

Parameters:
Left : Left coordinate of the cursor, relative to the window
Top : Top coordinate of the cursor, relative to the window

void sf::Window::SetPosition ( int  Left,
int  Top 
) [inherited]

Change the position of the window on screen.

Only works for top-level windows

Parameters:
Left : Left position
Top : Top position

void sf::Window::Show ( bool  State  )  [inherited]

Show or hide the window.

Parameters:
State : True to show, false to hide

bool sf::Window::SetCurrent (  )  const [inherited]

Set the window as the current target for rendering.

Returns:
True if operation was successful, false otherwise

void sf::Window::Display (  )  [inherited]

Display the window on screen.

const Input& sf::Window::GetInput (  )  const [inherited]

Get the input manager of the window.

Returns:
Reference to the input

void sf::Window::SetFramerateLimit ( unsigned int  Limit  )  [inherited]

Limit the framerate to a maximum fixed frequency.

Parameters:
Limit : Framerate limit, in frames per seconds (use 0 to disable limit)

float sf::Window::GetFrameTime (  )  const [inherited]

Get time elapsed since last frame.

Returns:
Time elapsed, in seconds

void sf::Window::SetJoystickThreshold ( float  Threshold  )  [inherited]

Change the joystick threshold, ie.

the value below which no move event will be generated

Parameters:
Threshold : New threshold, in range [0, 100]


The documentation for this class was generated from the following file: