SDL Utility
RenderWindow Class Reference

A class that handles window related functionality. More...

#include <RenderWindow.hpp>

Inheritance diagram for RenderWindow:
Window RenderTarget

Public Member Functions

 RenderWindow ()
 Default Constructor. No window or renderer is created. More...
 
 RenderWindow (Vector2u dimension, const std::string &title, Uint32 windowFlags=Window::Flags::Shown)
 Creates a window and renderer with the given parameters. More...
 
 RenderWindow (const RenderWindow &other)=delete
 
 RenderWindow (const RenderWindow &&other)=delete
 
virtual ~RenderWindow ()
 
- Public Member Functions inherited from Window
 Window ()
 Default Constructor. No window is created. More...
 
 Window (Vector2u dimension, const std::string &title, Uint32 windowFlags)
 Creates a window with the given parameters. More...
 
 Window (const Window &other)=delete
 
 Window (Window &&other)=delete
 
virtual ~Window ()
 
void Create (Vector2u dimension, const std::string &title, Uint32 windowFlags)
 Creates the window. More...
 
void Close ()
 Destroys the window. More...
 
bool IsOpen () const
 Wether or not the window object is created. More...
 
bool PollEvent (SDL_Event *event)
 A non-blocking event polling function. More...
 
bool WaitEvent (SDL_Event *event)
 A blocking event polling function. More...
 
Vector2i GetPosition () const
 Returns the current position of the window. More...
 
void SetPosition (Vector2i position)
 Sets a new window position. More...
 
void SetPosition (int x, int y)
 Sets a new window position. More...
 
Vector2u GetSize () const
 Gets the current window size. More...
 
void SetSize (Vector2u size)
 Sets a new window size. More...
 
void SetSize (unsigned int width, unsigned int height)
 Sets a new window size. More...
 
std::string GetTitle () const
 Gets the current window title. More...
 
void SetTitle (std::string title)
 Sets a new window title. More...
 
SDL_Window *const GetWindow () const
 Returns a constant pointer to the SDL_Window. More...
 
void SetVisible (bool visible)
 Set the windows visibility. More...
 
void SetVsync (bool vsync)
 (De)activates VSync !globally! More...
 
void SetMouseCursorVisible (bool visible)
 Hides/Shows the mouse cursor inside the windos. More...
 
void SetMouseCursorGrabbed (bool grabbed)
 Traps the mouse cursor inside the window. More...
 
void SetIcon (Uint32 width, Uint32 height, const Uint8 *pixels)
 Sets the window icon to an array of RGBA values. More...
 
void SetIcon (Uint32 width, Uint32 height, const Uint32 *pixels)
 Sets the window icon to an array of RGBA values. More...
 
void SetIcon (SDL_Surface *icon)
 Sets the window icon to a SDL_Surface. More...
 
void SetMouseCursor (SDL_Cursor *cursor)
 Changes the mouse cursor. More...
 
void SetMouseCursor (const Cursor &cursor)
 Changes the mouse cursor. More...
 
- Public Member Functions inherited from RenderTarget
virtual ~RenderTarget ()
 
void Clear (const Color &color=Color::Black)
 Clears the display. More...
 
void Draw (const Drawable &drawable)
 Draws a sdlu::Drawable to the SDL_Renderer. More...
 
void Display ()
 Display the current state of the renderer to the screen. More...
 
void SetMaxFramerate (Uint32 max)
 Sets a maximum framerate on the display function. More...
 

Protected Member Functions

virtual void OnCreate ()
 Function called after Window creation. More...
 
virtual bool OnResize ()
 Function called after resize event. More...
 
virtual void OnClose ()
 Function called after closing the window. More...
 
- Protected Member Functions inherited from RenderTarget
 RenderTarget (SDL_Window *target)
 Create Renderer and bind it to a window. More...
 
 RenderTarget (SDL_Surface *target)
 Create Renderer and bind it to a texture. More...
 

Additional Inherited Members

- Public Types inherited from Window
enum  Flags {
  Fullscreen = ((Uint32)1 << 0) , OpenGL = ((Uint32)1 << 1) , Shown = ((Uint32)1 << 2) , Hidden = ((Uint32)1 << 3) ,
  Borderless = ((Uint32)1 << 4) , Resizable = ((Uint32)1 << 5) , Minimized = ((Uint32)1 << 6) , Maximized = ((Uint32)1 << 7) ,
  InputGrabbed = ((Uint32)1 << 8) , InputFocus = ((Uint32)1 << 9) , MouseFocus = ((Uint32)1 << 10) , Foregin = ((Uint32)1 << 11) ,
  FullscreenDesktop = (Fullscreen | ((Uint32)1 << 12))
}
 
- Protected Attributes inherited from Window
SDL_Window * window
 
- Protected Attributes inherited from RenderTarget
SDL_Renderer * renderer
 The renderer object. More...
 

Detailed Description

A class that handles window related functionality.

A class that combines the SDL_Window and SDL_Renderer and behaves similar to the sf::RenderWindow from SFML. It provides utility and wrappers for common operations on those objects.

Constructor & Destructor Documentation

◆ RenderWindow() [1/4]

RenderWindow::RenderWindow ( )

Default Constructor. No window or renderer is created.

◆ RenderWindow() [2/4]

RenderWindow::RenderWindow ( Vector2u  dimension,
const std::string &  title,
Uint32  windowFlags = Window::Flags::Shown 
)

Creates a window and renderer with the given parameters.

Parameters
[in]dimensionA vector containing the width and height
[in]titleThe title of the create window

◆ RenderWindow() [3/4]

RenderWindow::RenderWindow ( const RenderWindow other)
delete

◆ RenderWindow() [4/4]

RenderWindow::RenderWindow ( const RenderWindow &&  other)
delete

◆ ~RenderWindow()

virtual RenderWindow::~RenderWindow ( )
virtual

Member Function Documentation

◆ OnClose()

virtual void RenderWindow::OnClose ( )
protectedvirtual

Function called after closing the window.

Reimplemented from Window.

◆ OnCreate()

virtual void RenderWindow::OnCreate ( )
protectedvirtual

Function called after Window creation.

Reimplemented from Window.

◆ OnResize()

virtual bool RenderWindow::OnResize ( )
protectedvirtual

Function called after resize event.

Returns
True if the resize event should not be returned via PollEvent()

Reimplemented from Window.


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