Render context class for desktop operating systems such as Windows and Linux. More...
#include <spDesktopRenderContext.hpp>
Public Member Functions | |
DesktopRenderContext () | |
virtual | ~DesktopRenderContext () |
virtual bool | openGraphicsScreen (void *ParentWindow, const dim::size2di &Resolution, const io::stringc &Title, s32 ColorDepth, bool isFullscreen, const SDeviceFlags &Flags) |
virtual void | closeGraphicsScreen () |
Closes the graphics screen and releases all hardware specific resources. | |
virtual void | flipBuffers () |
virtual bool | activate () |
Activates the render context by making it to the current. | |
virtual bool | deactivate () |
Deactivates the render context. | |
virtual void | setWindowTitle (const io::stringc &Title) |
Sets the window title. | |
virtual io::stringc | getWindowTitle () const |
Returns the window title. | |
virtual void | setWindowPosition (const dim::point2di &Position) |
Sets the window position. By default the window is screen centered. | |
virtual dim::point2di | getWindowPosition () const |
Returns the window position. | |
virtual dim::size2di | getWindowSize () const |
Returns the window size. | |
virtual dim::size2di | getWindowBorder () const |
Returns the window border size. | |
virtual bool | isWindowActive () const |
Returns true if the window is the active one. | |
virtual void * | getWindowObject () |
Protected Member Functions | |
void | registerWindowClass () |
void | unregisterWindowClass () |
DWORD | getWindowStyle () const |
void | getWindowDimension (dim::point2di &Position, dim::size2di &Size) const |
void | updateWindowStyleAndDimension () |
void | updateScreenOffset (bool isFullscreen) |
bool | createWindow (const io::stringc &Title) |
void | deleteWindow () |
void | showWindow () |
Protected Attributes | |
HWND | Window_ |
HDC | DeviceContext_ |
Static Protected Attributes | |
static const c8 * | WINDOW_CLASSNAME |
Friends | |
class | OpenGLSharedRenderContext |
class | sp::SoftPixelDeviceWin32 |
Render context class for desktop operating systems such as Windows and Linux.
sp::video::DesktopRenderContext::DesktopRenderContext | ( | ) |
virtual sp::video::DesktopRenderContext::~DesktopRenderContext | ( | ) | [virtual] |
virtual bool sp::video::DesktopRenderContext::activate | ( | ) | [virtual] |
Activates the render context by making it to the current.
Implements sp::video::RenderContext.
Reimplemented in sp::video::Direct3D9RenderContext, and sp::video::OpenGLRenderContext.
virtual void sp::video::DesktopRenderContext::closeGraphicsScreen | ( | ) | [virtual] |
Closes the graphics screen and releases all hardware specific resources.
Implements sp::video::RenderContext.
Reimplemented in sp::video::Direct3D9RenderContext, sp::video::Direct3D11RenderContext, and sp::video::OpenGLRenderContext.
bool sp::video::DesktopRenderContext::createWindow | ( | const io::stringc & | Title | ) | [protected] |
virtual bool sp::video::DesktopRenderContext::deactivate | ( | ) | [virtual] |
Deactivates the render context.
Implements sp::video::RenderContext.
Reimplemented in sp::video::Direct3D9RenderContext, and sp::video::OpenGLRenderContext.
void sp::video::DesktopRenderContext::deleteWindow | ( | ) | [protected] |
virtual void sp::video::DesktopRenderContext::flipBuffers | ( | ) | [virtual] |
Flips the buffers to see the final image onto the monitor. If vsync (vertical synchronisation) is enabled the program waits at this point until the graphics card releases the synchronisation.
Implements sp::video::RenderContext.
Reimplemented in sp::video::Direct3D9RenderContext, sp::video::Direct3D11RenderContext, and sp::video::OpenGLRenderContext.
virtual dim::size2di sp::video::DesktopRenderContext::getWindowBorder | ( | ) | const [virtual] |
Returns the window border size.
Reimplemented from sp::video::RenderContext.
void sp::video::DesktopRenderContext::getWindowDimension | ( | dim::point2di & | Position, | |
dim::size2di & | Size | |||
) | const [protected] |
virtual void* sp::video::DesktopRenderContext::getWindowObject | ( | ) | [virtual] |
Returns the window object. For MS/Windows it's a HWND* and on GNU/Linux it's a Window*.
#if defined(SP_PLATFORM_WINDOWS) HWND hWnd = *((HWND*)Context->getWindowObject()); #elif defined(SP_PLATFORM_LINUX) Window XWin = *((Window*)Context->getWindowObject()); #endif
Implements sp::video::RenderContext.
virtual dim::point2di sp::video::DesktopRenderContext::getWindowPosition | ( | ) | const [virtual] |
Returns the window position.
Reimplemented from sp::video::RenderContext.
virtual dim::size2di sp::video::DesktopRenderContext::getWindowSize | ( | ) | const [virtual] |
Returns the window size.
Reimplemented from sp::video::RenderContext.
DWORD sp::video::DesktopRenderContext::getWindowStyle | ( | ) | const [protected] |
virtual io::stringc sp::video::DesktopRenderContext::getWindowTitle | ( | ) | const [virtual] |
Returns the window title.
Reimplemented from sp::video::RenderContext.
virtual bool sp::video::DesktopRenderContext::isWindowActive | ( | ) | const [virtual] |
Returns true if the window is the active one.
Reimplemented from sp::video::RenderContext.
virtual bool sp::video::DesktopRenderContext::openGraphicsScreen | ( | void * | ParentWindow, | |
const dim::size2di & | Resolution, | |||
const io::stringc & | Title, | |||
s32 | ColorDepth, | |||
bool | isFullscreen, | |||
const SDeviceFlags & | Flags | |||
) | [virtual] |
Opens the graphics screen. This function will be called automatically once when the graphics device will be created.
[in] | ParentWindow | Pointer to the window object. For MS/Windows this must be a pointer to a HWND instance or null if no parent window is to be used. |
[in] | Resolution | Specifies the screen resolution for this context. |
[in] | Title | Specifies the window title. |
[in] | ColorDepth | Specifies the color bit depth. Valid values are 16, 24 and 32. |
[in] | isFullscreen | Specifies whether fullscreen is to be enabled or disabled. |
[in] | Flags | Specifies the device flags. This contains information about anti-aliasing and some other options. |
Implements sp::video::RenderContext.
Reimplemented in sp::video::Direct3D9RenderContext, sp::video::Direct3D11RenderContext, and sp::video::OpenGLRenderContext.
void sp::video::DesktopRenderContext::registerWindowClass | ( | ) | [protected] |
virtual void sp::video::DesktopRenderContext::setWindowPosition | ( | const dim::point2di & | Position | ) | [virtual] |
Sets the window position. By default the window is screen centered.
Reimplemented from sp::video::RenderContext.
virtual void sp::video::DesktopRenderContext::setWindowTitle | ( | const io::stringc & | Title | ) | [virtual] |
Sets the window title.
Reimplemented from sp::video::RenderContext.
void sp::video::DesktopRenderContext::showWindow | ( | ) | [protected] |
void sp::video::DesktopRenderContext::unregisterWindowClass | ( | ) | [protected] |
void sp::video::DesktopRenderContext::updateScreenOffset | ( | bool | isFullscreen | ) | [protected] |
void sp::video::DesktopRenderContext::updateWindowStyleAndDimension | ( | ) | [protected] |
friend class OpenGLSharedRenderContext [friend] |
Reimplemented in sp::video::OpenGLRenderContext.
friend class sp::SoftPixelDeviceWin32 [friend] |
HDC sp::video::DesktopRenderContext::DeviceContext_ [protected] |
HWND sp::video::DesktopRenderContext::Window_ [protected] |
const c8* sp::video::DesktopRenderContext::WINDOW_CLASSNAME [static, protected] |