class EE::Window::Engine¶
Overview¶
The window management class. Here the engine starts working. (Singleton Class). More…
#include <engine.hpp> class Engine { public: // construction ~Engine(); // methods EE::Window::Window* createWindow(WindowSettings Settings, ContextSettings Context = ContextSettings()); void destroyWindow(EE::Window::Window* window); EE::Window::Window* getCurrentWindow() const; void setCurrentWindow(EE::Window::Window* window); Uint32 getWindowCount() const; bool isRunning() const; bool existsWindow(EE::Window::Window* window); void forEachWindow(std::function<void(EE::Window::Window*)> cb); EE::Window::Window* getWindowID(const Uint32& winID); WindowSettings createWindowSettings(std::string iniPath, std::string iniKeyName = "EEPP"); WindowSettings createWindowSettings(IniFile* ini, std::string iniKeyName = "EEPP"); ContextSettings createContextSettings(std::string iniPath, std::string iniKeyName = "EEPP"); ContextSettings createContextSettings(IniFile* ini, std::string iniKeyName = "EEPP", bool vsyncEnabledByDefault = true); void enableSharedGLContext(); void disableSharedGLContext(); bool isSharedGLContextEnabled(); bool isThreaded(); Uint32 getMainThreadId(); bool isMainThread() const; PlatformHelper* getPlatformHelper(); DisplayManager* getDisplayManager(); bool openURI(const std::string& url); static bool isEngineRunning(); static bool isRunninMainThread(); };
Detailed Documentation¶
The window management class. Here the engine starts working. (Singleton Class).
Methods¶
EE::Window::Window* createWindow(WindowSettings Settings, ContextSettings Context = ContextSettings())
Creates a new window.
void destroyWindow(EE::Window::Window* window)
Destroy the window instance, and set as current other window running ( if any ). This function is only useful for multi-window environment. Avoid using it with one window context.
EE::Window::Window* getCurrentWindow() const
Returns:
The current Window context.
void setCurrentWindow(EE::Window::Window* window)
Set the window as the current.
Uint32 getWindowCount() const
Returns:
The number of windows created.
bool isRunning() const
Returns:
If any window is created.
bool existsWindow(EE::Window::Window* window)
Returns:
If the window instance is inside the window list.
WindowSettings createWindowSettings(std::string iniPath, std::string iniKeyName = "EEPP")
Constructs WindowSettings from an ini file It will search for the following properties: Width Window width Height Window height BitColor 32,16,8 Windowed bool Resizeable bool Backend SDL2 WinIcon The path to the window icon WinTitle The window default title
Parameters:
iniPath |
The ini file path |
iniKeyName |
The ini key name to search the properties |
WindowSettings createWindowSettings(IniFile* ini, std::string iniKeyName = "EEPP")
Constructs WindowSettings from an ini file instance It will search for the following properties: Width Window width Height Window height BitColor 32,16,8 Windowed bool Resizeable bool Backend SDL2 WinIcon The path to the window icon WinTitle The window default title
Parameters:
ini |
The ini file instance |
iniKeyName |
The ini key name to search the properties |
ContextSettings createContextSettings(std::string iniPath, std::string iniKeyName = "EEPP")
Constructs ContextSettings from an ini file
It will search for the following properties: VSync bool GLVersion Selects the default renderer: 2 for OpenGL 2, 3 for OpenGL 3, 4 for OpenGL ES 2 DoubleBuffering bool DepthBufferSize int StencilBufferSize int
@param iniPath The ini file path
@param iniKeyName The ini key name to search the properties
ContextSettings createContextSettings(IniFile* ini, std::string iniKeyName = "EEPP", bool vsyncEnabledByDefault = true)
Constructs ContextSettings from an ini file instance
It will search for the following properties: VSync bool GLVersion Selects the default renderer: 2 for OpenGL 2, 3 for OpenGL 3, 4 for OpenGL ES 2 DoubleBuffering bool DepthBufferSize int StencilBufferSize int
@param ini The ini file instance
@param iniKeyName The ini key name to search the properties
void enableSharedGLContext()
Enabling Shared GL Context allows asynchronous OpenGL resource loading ( only if is supported by the backend and the OS, SDL 2 backend is the only one supported ). * If the TextureLoader is threaded, will upload the texture in another thread to the GPU. So, it will not block the main rendering thread. * Shared GL Context is disabled by default.
void disableSharedGLContext()
Disable the Shared GL Context
See also:
bool isSharedGLContextEnabled()
Returns:
If the Shared GL Context is enabled and ready to use.
bool isThreaded()
Returns:
Indicates if the current running platform/OS supports threads (always true except for emscripten)
Uint32 getMainThreadId()
Returns:
The id of the thread that was used to initialize the OpenGL Context.
bool isMainThread() const
Returns:
True if the current thread is the main thread.
PlatformHelper* getPlatformHelper()
Returns:
The instance of platform class that provides some helpers for some platforms
DisplayManager* getDisplayManager()
Returns:
The display manager. Holds the physical displays information.
bool openURI(const std::string& url)
Open a URL in a separate, system-provided application.
Returns:
true if success