CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::UIWindowSurfaceDevice Class Reference

A UIWindowDevice implementation that offers graphics accelerated rendering of the UI. More...

#include <CeresEngine/UI/UIWindowDevice.hpp>

Inheritance diagram for CeresEngine::UIWindowSurfaceDevice:
CeresEngine::UIWindowFramebufferDevice CeresEngine::UIWindowDevice CeresEngine::RefCounted< UIWindowDevice >

Classes

struct  WindowInformation
 A structure that describes information about each window registered with the device. More...
 

Public Member Functions

 UIWindowSurfaceDevice (Platform &platform, Renderer &renderer)
 Creates a new window surface device.
 
UIBackingStorePtr createBackingStore (UIWindow &window) override
 
void flush (UIWindow &window, UIBackingStore &backingStore) override
 
double getBackingScaleFactor (const UIWindow &window) const override
 The backing scale factor.
 
UIBackingStorePtr registerWindow (UIWindow &window) override
 Registers a window with this device.
 
void unregisterWindow (UIWindow &window) override
 Unregisters the window from this device.
 
- Public Member Functions inherited from CeresEngine::UIWindowFramebufferDevice
 UIWindowFramebufferDevice (Renderer &renderer)
 
void draw (UIBackingStore &backingStore, UIDrawCommandBuffer &drawCommandBuffer) override
 Draws the UI command buffer into the backing store.
 
- Public Member Functions inherited from CeresEngine::UIWindowDevice
 UIWindowDevice () noexcept=default
 
virtual ~UIWindowDevice () noexcept=default
 
- Public Member Functions inherited from CeresEngine::RefCounted< UIWindowDevice >
 RefCounted (Args &&... args)
 Creates a new RefCounted object and constructs a new Deleter by forwarding Args to it.
 
void retain () noexcept
 Retains the object by increment it's reference count by one.
 
bool release () noexcept
 Relases the object by decrementing it's reference count by one.
 

Private Types

using super = UIWindowFramebufferDevice
 

Private Member Functions

void onSurfaceEvent (UIWindow &window, const AnyInputEvent &)
 
void onSurfaceResize (UIWindow &window, const Vector2 &newSize)
 
void onSurfaceClose ()
 

Private Attributes

PlatformmPlatform
 The platform object that will be used to create the window surfaces that will back each UIWindow registered.
 
HashMap< UIWindow *, WindowInformationmWindows
 A map of all registered windows.
 
Vector< UIWindowPtrmDirtyWindows
 A set of dirty windows.
 

Additional Inherited Members

- Protected Member Functions inherited from CeresEngine::UIWindowDevice
void notifyFrameChanged (UIWindow &window, const UIRect &newFrame)
 Utility method that must be called by device implementations when the window frame changes.
 
void notifyBackingScaleFactorChange (UIWindow &window, double newBackingScalingFactor)
 Utility method that must be called by device implementations when the window scaling factor changes.
 
- Protected Attributes inherited from CeresEngine::UIWindowFramebufferDevice
RenderermRenderer
 
UIRenderer mUIRenderer
 The renderer that will render the UI elements on a texture.
 

Detailed Description

A UIWindowDevice implementation that offers graphics accelerated rendering of the UI.

Windows are backed by an operating-system provided window surface. Events from this window surface are directly proxied to the UIWindow.

This device also automatically flushes the window contents to the GPU swapchain whenever they are flushed.

Member Typedef Documentation

◆ super

Constructor & Destructor Documentation

◆ UIWindowSurfaceDevice()

CeresEngine::UIWindowSurfaceDevice::UIWindowSurfaceDevice ( Platform platform,
Renderer renderer 
)
explicit

Creates a new window surface device.

Member Function Documentation

◆ createBackingStore()

UIBackingStorePtr CeresEngine::UIWindowSurfaceDevice::createBackingStore ( UIWindow window)
overridevirtual

◆ flush()

void CeresEngine::UIWindowSurfaceDevice::flush ( UIWindow window,
UIBackingStore backingStore 
)
overridevirtual

◆ getBackingScaleFactor()

double CeresEngine::UIWindowSurfaceDevice::getBackingScaleFactor ( const UIWindow window) const
overridevirtual

The backing scale factor.

The value of this property is 2.0 for high-resolution scaled display modes, and 1.0 for all other cases.

There are some scenarios where an application that is resolution-aware may want to reason on its own about the display environment it is running in. It is important to note that the value of this property does not represent anything concrete, such as pixel density or physical size, because it can vary based on the configured display mode. For example, the display may be in a mirrored configuration that is still high-resolution scaled, resulting in pixel geometry that may not match the native resolution of the display device.

Note
For almost all common cases, developers should avoid using the value of getBackingScaleFactor() as an input to layout or drawing calculations. Developers should instead use the backing coordinate space conversion methods, because the resulting code will more likely work consistently and correctly under both standard and high-resolution operation.

Reimplemented from CeresEngine::UIWindowDevice.

◆ onSurfaceClose()

void CeresEngine::UIWindowSurfaceDevice::onSurfaceClose ( )
private

◆ onSurfaceEvent()

void CeresEngine::UIWindowSurfaceDevice::onSurfaceEvent ( UIWindow window,
const AnyInputEvent  
)
private

◆ onSurfaceResize()

void CeresEngine::UIWindowSurfaceDevice::onSurfaceResize ( UIWindow window,
const Vector2 newSize 
)
private

◆ registerWindow()

UIBackingStorePtr CeresEngine::UIWindowSurfaceDevice::registerWindow ( UIWindow window)
overridevirtual

Registers a window with this device.

The registration can return a valid UIBackingStore that the window can use as a rendering target for it's contents. If no backing store is returned, drawing the UIWindow is unavailable.

Reimplemented from CeresEngine::UIWindowDevice.

◆ unregisterWindow()

void CeresEngine::UIWindowSurfaceDevice::unregisterWindow ( UIWindow window)
overridevirtual

Unregisters the window from this device.

Reimplemented from CeresEngine::UIWindowDevice.

Member Data Documentation

◆ mDirtyWindows

Vector<UIWindowPtr> CeresEngine::UIWindowSurfaceDevice::mDirtyWindows
private

A set of dirty windows.

Those windows are pending flushes and will be flushed the next time the main thread becomes idle.

◆ mPlatform

Platform& CeresEngine::UIWindowSurfaceDevice::mPlatform
private

The platform object that will be used to create the window surfaces that will back each UIWindow registered.

◆ mWindows

HashMap<UIWindow*, WindowInformation> CeresEngine::UIWindowSurfaceDevice::mWindows
private

A map of all registered windows.


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