HoverRace
2.0
|
Base class for display managers. More...
#include <Display.h>
Public Types | |
using | displayConfigChangedSignal_t = boost::signals2::signal< void(int, int)> |
using | uiScaleChangedSignal_t = boost::signals2::signal< void(double)> |
Public Member Functions | |
Display () | |
virtual | ~Display () |
uiLayoutFlags_t | AddUiLayoutFlags (uiLayoutFlags_t flags) noexcept |
Combine the current UI layout flags with new flags. More... | |
Vec2 | AddUiOrigin (const Vec2 &vec) noexcept |
Shift the current UI origin coordinates by an offset. More... | |
void | CleanTypeCaseCache () |
Clean up the cache of TypeCase instances. More... | |
virtual void | Flip ()=0 |
Rendering for the frame has completed; update the screen. More... | |
displayConfigChangedSignal_t & | GetDisplayConfigChangedSignal () |
virtual VideoServices::VideoBuffer & | GetLegacyDisplay () const =0 |
Retrieve the legacy (8-bit) framebuffer. More... | |
std::shared_ptr< TypeCase > | GetTypeCase (const UiFont &font) |
Retrieve or create the TypeCase for a particular font. More... | |
const Vec2 & | GetUiOffset () const noexcept |
const Vec2 & | GetUiOrigin () const noexcept |
Retrieve the current UI origin coordinates. More... | |
double | GetUiScale () const noexcept |
uiScaleChangedSignal_t & | GetUiScaleChangedSignal () |
const Vec2 & | GetUiScreenSize () const noexcept |
Retrieve the dimensions of the screen, in UI coordinates. More... | |
Vec2 | LayoutUiPosition (const Vec2 &relPos, uiLayoutFlags_t layoutFlags=0) noexcept |
virtual void | OnDesktopModeChanged (int width, int height)=0 |
Reconfigure the display when the desktop resolution has changed. More... | |
virtual void | OnDisplayConfigChanged () |
Reconfigure the display based on the new configuration. More... | |
virtual void | Screenshot ()=0 |
Take a screenshot. More... | |
void | SetUiLayoutFlags (uiLayoutFlags_t flags) noexcept |
Explicitly set the current UI layout flags. More... | |
void | SetUiOrigin (const Vec2 &vec) noexcept |
Explicitly set the UI origin coordinates. More... | |
![]() | |
virtual void | AttachView (ActiveText &model)=0 |
Attach the display-specific view. More... | |
![]() | |
virtual void | AttachView (BaseContainer &model)=0 |
Attach the display-specific view. More... | |
![]() | |
virtual void | AttachView (Button &model)=0 |
Attach the display-specific view. More... | |
![]() | |
virtual void | AttachView (ClickRegion &model)=0 |
Attach the display-specific view. More... | |
![]() | |
virtual void | AttachView (FillBox &model)=0 |
Attach the display-specific view. More... | |
![]() | |
virtual void | AttachView (KeycapIcon &model)=0 |
Attach the display-specific view. More... | |
![]() | |
virtual void | AttachView (Label &model)=0 |
Attach the display-specific view. More... | |
![]() | |
virtual void | AttachView (Picture &model)=0 |
Attach the display-specific view. More... | |
![]() | |
virtual void | AttachView (RuleLine &model)=0 |
Attach the display-specific view. More... | |
![]() | |
virtual void | AttachView (ScreenFade &model)=0 |
Attach the display-specific view. More... | |
![]() | |
virtual void | AttachView (Slider &model)=0 |
Attach the display-specific view. More... | |
![]() | |
virtual void | AttachView (SymbolIcon &model)=0 |
Attach the display-specific view. More... | |
![]() | |
virtual void | AttachView (Wallpaper &model)=0 |
Attach the display-specific view. More... | |
Public Attributes | |
Styles | styles |
Protected Member Functions | |
void | FireDisplayConfigChangedSignal (int width, int height) const |
void | FireUiScaleChangedSignal (double scale) const |
virtual std::shared_ptr< TypeCase > | MakeTypeCase (const UiFont &font)=0 |
Create a new TypeCase for a given font. More... | |
Private Attributes | |
displayConfigChangedSignal_t | displayConfigChangedSignal |
std::unordered_map< UiFont, std::weak_ptr< TypeCase > > | typeCases |
uiLayoutFlags_t | uiLayoutFlags |
Vec2 | uiOffset |
Vec2 | uiOrigin |
double | uiScale |
uiScaleChangedSignal_t | uiScaleChangedSignal |
Vec2 | uiScreenSize |
Base class for display managers.
A display manager handles the API-specific tasks of lifecycle stages, instantiating views, and accessing shared resources.
using HoverRace::Display::Display::displayConfigChangedSignal_t = boost::signals2::signal<void(int, int)> |
using HoverRace::Display::Display::uiScaleChangedSignal_t = boost::signals2::signal<void(double)> |
|
inline |
|
inlinevirtual |
|
inlinenoexcept |
Combine the current UI layout flags with new flags.
flags | The new flags. |
Shift the current UI origin coordinates by an offset.
vec | The offset (in UI-space). |
void HoverRace::Display::Display::CleanTypeCaseCache | ( | ) |
|
protected |
|
protected |
|
pure virtual |
Rendering for the frame has completed; update the screen.
Implemented in HoverRace::Display::SDL::SdlDisplay.
|
inline |
|
pure virtual |
Retrieve the legacy (8-bit) framebuffer.
The legacy framebuffer provides an 8-bit surface for drawing. This framebuffer is drawn as the background layer since it doesn't have an alpha channel.
Implemented in HoverRace::Display::SDL::SdlDisplay.
|
inlinenoexcept |
|
inlinenoexcept |
Retrieve the current UI origin coordinates.
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
Retrieve the dimensions of the screen, in UI coordinates.
This is useful for components with UiLayoutFlags::FLOATING set, but without UiLayoutFlags::UNSCALED.
|
inlinenoexcept |
|
protectedpure virtual |
Create a new TypeCase for a given font.
This is called by GetTypeCase() when the TypeCase is not in the cache.
font | The normalized font. |
nullptr
. Implemented in HoverRace::Display::SDL::SdlDisplay.
|
pure virtual |
Reconfigure the display when the desktop resolution has changed.
This should be called whenever the desktop resolution changes, so the aspect ratio can be maintained in windowed mode.
width | The width of the desktop in pixels. |
height | The height of the desktop in pixels. |
Implemented in HoverRace::Display::SDL::SdlDisplay.
|
virtual |
Reconfigure the display based on the new configuration.
This should be called whenever the video configuration of Util::Config changes.
Reimplemented in HoverRace::Display::SDL::SdlDisplay.
|
pure virtual |
Take a screenshot.
Implemented in HoverRace::Display::SDL::SdlDisplay.
|
inlinenoexcept |
Explicitly set the current UI layout flags.
Calls to LayoutUiPosition combine the current layout flags with the widget layout flags when determining the adjusted position.
flags | The new flags. |
|
inlinenoexcept |
Explicitly set the UI origin coordinates.
All UI coordinates go through LayoutUiPosition will be translated by this offset. In other words, this shifts where in UI-space the coordinates (0.0, 0.0) are.
vec | The coordinates (in UI-space). |
|
private |
Styles HoverRace::Display::Display::styles |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |