Rose
Public Member Functions | Public Attributes | Protected Attributes | List of all members
rose::gm::GraphicsModel Class Reference
Collaboration diagram for rose::gm::GraphicsModel:
Collaboration graph
[legend]

Public Member Functions

bool initialize (const std::string &title, Size initialSize, const Position< int > &initialPosition, uint32_t extraFlags)
 
void eventLoop (std::shared_ptr< Screen > &screen)
 The Rose version of the SDL event loop.
 
void drawAll (std::shared_ptr< Screen > &screen)
 Draw the screen. More...
 
Contextcontext ()
 
int currentDisplayIndex () const
 
Rectangle displayBounds (int displayIndex=-1)
 
Rectangle screenRectangle ()
 
void redrawBackground ()
 
Padding windowBorders () const noexcept
 
SdlWindowgetSdlWindow ()
 

Public Attributes

RoseErrorCode ErrorCode {RoseErrorCode::OK}
 
std::function< void(SDL_Event)> eventCallback {}
 

Protected Attributes

SdlWindow mSdlWindow {}
 The SDL_Window which provides the application "Screen".
 
Context mContext {}
 The graphics context used by the application graphics model.
 
bool mRunEventLoop {true}
 Event loop continues while this is true.
 
bool mRedrawBackground {true}
 When true the background Texture needs to be redrawn.
 
Texture mBackground {}
 The background Texture.
 
uint32_t mFrame {}
 The rendering frame.
 
std::vector< RectanglemDisplayBounds {}
 

Member Function Documentation

◆ drawAll()

void rose::gm::GraphicsModel::drawAll ( std::shared_ptr< Screen > &  screen)

Draw the screen.

Screen drawing is accomplished in two steps. If/when the background needs to be redrawn (mRedrawBackground is true) the background widgets (the majority of them) are rendered to the mBackground Texture which is then rendered to the frame buffer.

If mRedrawBackground is false, but mAnimation is true mBackground is rendered to the screen, then animated Widgets, those that change at sub-second rates, are rendered to the screen on top of the background.

If neither mRedrawBackground nor mAnimation are true no rendering of the screen is required.

Parameters
screenThe Screen object to draw.

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