Scarab
A thin, game-agnostic 2D engine host built on the sunlight tile-map engine
Loading...
Searching...
No Matches
irendererprovider.h
Go to the documentation of this file.
1/*
2 * Copyright (c) since 2021 by PopolonY2k and Leidson Campos A. Ferreira
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 *
8 * Permission is granted to anyone to use this software for any purpose,
9 * including commercial applications, and to alter it and redistribute it
10 * freely, subject to the following restrictions:
11 *
12 * 1. The origin of this software must not be misrepresented; you must not
13 * claim that you wrote the original software. If you use this software
14 * in a product, an acknowledgment in the product documentation would be
15 * appreciated but is not required.
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 * 3. This notice may not be removed or altered from any source distribution.
19 */
20
21#ifndef __IRENDERERPROVIDER_H__
22#define __IRENDERERPROVIDER_H__
23
24#include <string>
25#include "renderer/rendererconfig.h"
26
27namespace SunLight {
28 namespace TileMap { class ITileMap; }
29 namespace DrawSurface { class IDrawSurface; }
30}
31
32namespace Scarab {
33 namespace Engine {
34
49
50 public:
51
53 enum Origin {
54 ORIGIN_NONE = 0, // no renderer yet
55 ORIGIN_CREATED, // an explicit CreateRenderer (renderer_create)
56 ORIGIN_LAZY_DEFAULT, // implicitly, by the first call that needed a window
58 };
59
60 virtual ~IRendererProvider( void ) {}
61
69 virtual SunLight :: TileMap :: ITileMap* GetTileMap( const char *szTrigger ) = 0;
70
75 virtual SunLight :: DrawSurface :: IDrawSurface* GetDrawSurface( const char *szTrigger ) = 0;
76
82 virtual SunLight :: DrawSurface :: IDrawSurface* PeekDrawSurface( void ) = 0;
83
90 virtual bool CreateRenderer( const SunLight :: Renderer :: RendererConfig &config, std :: string *pError ) = 0;
91
93 virtual Origin GetOrigin( void ) = 0;
94
96 virtual bool IsHeadless( void ) = 0;
97
99 virtual SunLight :: Renderer :: RendererConfig GetDefaultConfig( void ) = 0;
100
105 virtual SunLight :: Renderer :: RendererConfig GetEffectiveConfig( void ) = 0;
106
108 virtual void NoteWindowTitle( const std :: string &strTitle ) = 0;
109 };
110 }
111}
112
113#endif /* __IRENDERERPROVIDER_H__ */
Where the Lua bridge gets the renderer from.
Definition irendererprovider.h:48
virtual Origin GetOrigin(void)=0
How the current renderer came to exist (ORIGIN_NONE if it doesn't yet).
virtual SunLight::Renderer::RendererConfig GetDefaultConfig(void)=0
The configuration an implicitly created renderer gets (Scarab's defaults).
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::Renderer::RendererConfig GetEffectiveConfig(void)=0
The configuration the current renderer was actually created with (after –headless was applied),...
virtual ~IRendererProvider(void)
Definition irendererprovider.h:60
virtual void NoteWindowTitle(const std ::string &strTitle)=0
Record a window-title change, so the effective configuration stays live.
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.
Origin
How the current renderer came to exist.
Definition irendererprovider.h:53
@ ORIGIN_CREATED
Definition irendererprovider.h:55
@ ORIGIN_LAZY_DEFAULT
Definition irendererprovider.h:56
@ ORIGIN_LAST
Definition irendererprovider.h:57
@ ORIGIN_NONE
Definition irendererprovider.h:54
virtual SunLight::DrawSurface::IDrawSurface * PeekDrawSurface(void)=0
The draw surface if a renderer already exists, else nullptr - never creates one. For readers that mus...
virtual bool IsHeadless(void)=0
Whether the process runs –headless (the null backend is forced).
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 reas...
Definition irendererprovider.h:32
Definition irendererprovider.h:27