File SDLWindowManager.h

namespace Gsage
class SDLWindow : public Window

Public Functions

SDLWindow(const std::string &name, SDL_Window *window)
virtual ~SDLWindow()
unsigned long long getWindowHandle()

Get window handle

void *getGLContext()

Get GL context

std::tuple<int, int> getPosition() const

Get window position

virtual void setPosition(int x, int y)

Sets window position

Parameters
  • x:

  • y:

virtual std::tuple<int, int> getSize()

Get window size

void setSize(int width, int height)

Set window size

Parameters
  • width:

  • height:

virtual std::tuple<int, int, int, int> getDisplayBounds()

Get display size information Selects the display which contains current window position

virtual float getScaleFactor() const

Get screen DPI that is used to display the window

virtual int getDisplay() const

Get display index that contains the window

virtual void show()

Show window

virtual void hide()

Hide window

Private Members

SDL_Window *mWindow
SDL_GLContext mGLContext

Friends

friend Gsage::SDLWindowManager
class SDLWindowManager : public WindowManager
#include <SDLWindowManager.h>

SDL Window Manager implementation

Public Functions

SDLWindowManager(const std::string &type, SDLCore *core)
virtual ~SDLWindowManager()
bool initialize(const DataProxy &config)

Inialize SDL system

Parameters

WindowPtr createWindow(const std::string &name, unsigned int width, unsigned int height, bool fullscreen, const DataProxy &params)

Create a window

Return

newly created window pointer

Parameters
  • create: a window

  • width: window width

  • height: window height

  • fullscreen: create a fullscreen window

  • params: additional parameters

virtual bool destroyWindow(WindowPtr window)

Close a window

Return

true if succeed

Parameters
  • window: window pointer to destroy

virtual void update(double time)

Update is used to render windows, whose rendering is handled by SDL2 itself

Parameters
  • time: Delta time

Private Types

typedef std::unique_ptr<SDLRenderer> SDLRendererPtr

Private Members

std::mutex mWindowsMutex
SDLCore *mCore
std::map<std::string, SDLRendererPtr> mRenderers