Scarab
A thin, game-agnostic 2D engine host built on the sunlight tile-map engine
Loading...
Searching...
No Matches
Scarab::Engine::IRendererProvider Class Referenceabstract

Where the Lua bridge gets the renderer from. More...

#include <irendererprovider.h>

Public Types

enum  Origin { ORIGIN_NONE = 0 , ORIGIN_CREATED , ORIGIN_LAZY_DEFAULT , ORIGIN_LAST }
 How the current renderer came to exist. More...
 

Public Member Functions

virtual ~IRendererProvider (void)
 
virtual SunLight::TileMap::ITileMap * GetTileMap (const char *szTrigger)=0
 The tile map, creating the default renderer (and opening its window) first if none exists yet.
 
virtual SunLight::DrawSurface::IDrawSurface * GetDrawSurface (const char *szTrigger)=0
 The draw surface, creating the default renderer first if none exists yet - see GetTileMap.
 
virtual SunLight::DrawSurface::IDrawSurface * PeekDrawSurface (void)=0
 The draw surface if a renderer already exists, else nullptr - never creates one. For readers that must not open a window as a side effect (eg. os.time's headless override).
 
virtual bool CreateRenderer (const SunLight ::Renderer ::RendererConfig &config, std ::string *pError)=0
 Explicitly create the process's renderer (renderer_create) and open its window. Fails - with the reason in *pError - if one already exists (naming the primitive that created the default one implicitly, when that's what happened), or if the configuration can't work.
 
virtual Origin GetOrigin (void)=0
 How the current renderer came to exist (ORIGIN_NONE if it doesn't yet).
 
virtual bool IsHeadless (void)=0
 Whether the process runs –headless (the null backend is forced).
 
virtual SunLight::Renderer::RendererConfig GetDefaultConfig (void)=0
 The configuration an implicitly created renderer gets (Scarab's defaults).
 
virtual SunLight::Renderer::RendererConfig GetEffectiveConfig (void)=0
 The configuration the current renderer was actually created with (after –headless was applied), with the title kept current across app_set_name.
 
virtual void NoteWindowTitle (const std ::string &strTitle)=0
 Record a window-title change, so the effective configuration stays live.
 

Detailed Description

Where the Lua bridge gets the renderer from.

The renderer does not exist yet when the Lua engine is built, or when a game's entry script starts running - the script may create it itself (renderer_create), and if it never does, the default one is created the first time something actually needs a window. So every primitive reaches ITileMap/IDrawSurface through this instead of holding a pointer taken at construction.

Lua-agnostic on purpose (like SpritePool): no lua_State here. Implemented by Scarab::Host::RendererProvider.

Member Enumeration Documentation

◆ Origin

How the current renderer came to exist.

Enumerator
ORIGIN_NONE 
ORIGIN_CREATED 
ORIGIN_LAZY_DEFAULT 
ORIGIN_LAST 

Constructor & Destructor Documentation

◆ ~IRendererProvider()

virtual Scarab::Engine::IRendererProvider::~IRendererProvider ( void  )
inlinevirtual

Member Function Documentation

◆ CreateRenderer()

virtual bool Scarab::Engine::IRendererProvider::CreateRenderer ( const SunLight ::Renderer ::RendererConfig &  config,
std ::string *  pError 
)
pure virtual

Explicitly create the process's renderer (renderer_create) and open its window. Fails - with the reason in *pError - if one already exists (naming the primitive that created the default one implicitly, when that's what happened), or if the configuration can't work.

◆ GetDefaultConfig()

virtual SunLight::Renderer::RendererConfig Scarab::Engine::IRendererProvider::GetDefaultConfig ( void  )
pure virtual

The configuration an implicitly created renderer gets (Scarab's defaults).

◆ GetDrawSurface()

virtual SunLight::DrawSurface::IDrawSurface * Scarab::Engine::IRendererProvider::GetDrawSurface ( const char *  szTrigger)
pure virtual

The draw surface, creating the default renderer first if none exists yet - see GetTileMap.

◆ GetEffectiveConfig()

virtual SunLight::Renderer::RendererConfig Scarab::Engine::IRendererProvider::GetEffectiveConfig ( void  )
pure virtual

The configuration the current renderer was actually created with (after –headless was applied), with the title kept current across app_set_name.

◆ GetOrigin()

virtual Origin Scarab::Engine::IRendererProvider::GetOrigin ( void  )
pure virtual

How the current renderer came to exist (ORIGIN_NONE if it doesn't yet).

◆ GetTileMap()

virtual SunLight::TileMap::ITileMap * Scarab::Engine::IRendererProvider::GetTileMap ( const char *  szTrigger)
pure virtual

The tile map, creating the default renderer (and opening its window) first if none exists yet.

Parameters
szTriggerName of the primitive that needs it, kept so a later renderer_create can say which call created the default renderer implicitly;

◆ IsHeadless()

virtual bool Scarab::Engine::IRendererProvider::IsHeadless ( void  )
pure virtual

Whether the process runs –headless (the null backend is forced).

◆ NoteWindowTitle()

virtual void Scarab::Engine::IRendererProvider::NoteWindowTitle ( const std ::string &  strTitle)
pure virtual

Record a window-title change, so the effective configuration stays live.

◆ PeekDrawSurface()

virtual SunLight::DrawSurface::IDrawSurface * Scarab::Engine::IRendererProvider::PeekDrawSurface ( void  )
pure virtual

The draw surface if a renderer already exists, else nullptr - never creates one. For readers that must not open a window as a side effect (eg. os.time's headless override).


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