Pictel 2d 0.1
Game Engine Documentation
Public Member Functions | List of all members
engine::EngineProviderI Class Referenceabstract

Public Member Functions

virtual void SetDesiredViewport (int width, int height)=0
 Engine setup. More...
 
virtual engine::Size GetDesiredViewport ()=0
 
virtual void SetViewportScale (float)=0
 Sets the viewport scale.
 
virtual uint64_t GetTicks ()=0
 Engine states. More...
 
virtual uint64_t GetPerformanceTicks ()=0
 More robuts results than GetTicks.
 
virtual uint64_t GetPerformanceCounter ()=0
 More robuts results than GetTicks.
 
virtual void Delay (uint32_t ms)=0
 Wait ms.
 
virtual void GetWindowSize (int *w, int *h)=0
 Get the current window size.
 
virtual void GetRendererOutputSize (int *w, int *h)=0
 Get the renderer output size.
 
virtual void SetRenderBackgroundColor (uint8_t r, uint8_t g, uint8_t b, uint8_t a)=0
 Renderer related. More...
 
virtual void ClearRender ()=0
 Clear the frambuffer with a previously set colour.
 
virtual void RenderPresent ()=0
 Update the screen with any rendering performed since the previous call.
 
virtual std::unique_ptr< DrawableSpriteIDrawableCreate (SpriteAtlasItemI *, float)=0
 Drawables. More...
 
virtual std::unique_ptr< DrawableTargetIDrawableTargetCreate (float, float)=0
 
virtual void DrawableRender (DrawableI *, SpriteRepresentationI *spr, float, float)=0
 
virtual void DrawableRender (DrawableI *, SpriteRepresentationI *spr, float, float, Color4)=0
 
virtual void DrawableTargetRender (DrawableTargetI *, float, float)=0
 Render the target drawable for the current frame at x, y.
 
virtual TextureILoadTexture (std::string name, FileStreamI *)=0
 Textures. More...
 
virtual TextureTargetICreateTargetTexture (int width, int height)=0
 
virtual void UnloadTexture (TextureI *texture)=0
 A concrete instance should unload the texture.
 
virtual void RendererTargetDrawablePush (DrawableTargetI *)=0
 Renderer specific. More...
 
virtual void RendererTargetDrawablePop ()=0
 
virtual void RendererTargetDrawableSet (DrawableTargetI *)=0
 
virtual void RenderTargetClear ()=0
 
virtual void RenderClear ()=0
 Clears the buffer before drawing a new frame.
 
virtual void RenderSetColor (uint8_t r, uint8_t g, uint8_t b, uint8_t a)=0
 Sets the draw color.
 
virtual void RenderSetScale (float scaleX, float scaleY)=0
 
virtual void RenderDrawRect (Engine_Rect *)=0
 Draw a rectangle.
 
virtual void RenderFillRect (Engine_Rect *)=0
 Draw a rectangle.
 
virtual void RenderDrawLine (int x1, int y1, int x2, int y2)=0
 Draw a rectangle.
 
virtual void RenderDrawPoint (int x1, int y1)=0
 Draw a point.
 

Detailed Description

EngineProviderI declares an abstraction for low-level drawing functions. Those are bare-bones only. The main entry point in the app initializes different concrete instances.

Member Function Documentation

◆ CreateTargetTexture()

virtual TextureTargetI * engine::EngineProviderI::CreateTargetTexture ( int  width,
int  height 
)
pure virtual

A concrete instance should create the target texture. A target texture is able to be rendered upon so a partial render can be developed. The ownership of the texture is passed to the caller.

◆ DrawableCreate()

virtual std::unique_ptr< DrawableSpriteI > engine::EngineProviderI::DrawableCreate ( SpriteAtlasItemI ,
float   
)
pure virtual

Drawables.

Given a sprite atlas item construct a drawable for the chosen scale.

◆ DrawableRender() [1/2]

virtual void engine::EngineProviderI::DrawableRender ( DrawableI ,
SpriteRepresentationI spr,
float  ,
float   
)
pure virtual

Render the drawable for the current frame at x, y. Uses the currently set lights that are to be taken into account when rendering the game objects.

◆ DrawableRender() [2/2]

virtual void engine::EngineProviderI::DrawableRender ( DrawableI ,
SpriteRepresentationI spr,
float  ,
float  ,
Color4   
)
pure virtual

Render the drawable for the current frame at x, y. Uses the currently set lights that are to be taken into account when rendering the game objects. This version allows for custom color mod.

◆ DrawableTargetCreate()

virtual std::unique_ptr< DrawableTargetI > engine::EngineProviderI::DrawableTargetCreate ( float  ,
float   
)
pure virtual

Given a size construct a drawable for the chosen scale. The drawable is to be used as a target rending object. The curren rendering pass should be rendered onto the texture. The drawable object should then be able to be rendered using ::DrawableTargetRender.

◆ GetTicks()

virtual uint64_t engine::EngineProviderI::GetTicks ( )
pure virtual

Engine states.

Concrete instance would get the ticks since the provider library initialized. The library itself should check for overflows.

◆ LoadTexture()

virtual TextureI * engine::EngineProviderI::LoadTexture ( std::string  name,
FileStreamI  
)
pure virtual

Textures.

A concrete instance should load the texture from the filename using the default internal file access classes. The ownership of the texture is passed to the caller.

◆ RendererTargetDrawablePop()

virtual void engine::EngineProviderI::RendererTargetDrawablePop ( )
pure virtual

Pops the renderer target texture from the stack and returned to the previous one or the main renderer if the stack is empty. Currently not used

◆ RendererTargetDrawablePush()

virtual void engine::EngineProviderI::RendererTargetDrawablePush ( DrawableTargetI )
pure virtual

Renderer specific.

Sets the render target to a target drawable. All rendering goes there until a the target is popped. Currently not used

◆ RendererTargetDrawableSet()

virtual void engine::EngineProviderI::RendererTargetDrawableSet ( DrawableTargetI )
pure virtual

Sets the drawable as the current render target. Currently not used

◆ RenderSetScale()

virtual void engine::EngineProviderI::RenderSetScale ( float  scaleX,
float  scaleY 
)
pure virtual

Sets the render scale. Has no effect on non-sdl providers

◆ RenderTargetClear()

virtual void engine::EngineProviderI::RenderTargetClear ( )
pure virtual

Clears the render target so the final render can be applied. Currently not used

◆ SetDesiredViewport()

virtual void engine::EngineProviderI::SetDesiredViewport ( int  width,
int  height 
)
pure virtual

Engine setup.

Sets the desired viewport. It will affect the aspect ratio. The engine them will attemp to compensate by scaling and translating the remainder of the view.

◆ SetRenderBackgroundColor()

virtual void engine::EngineProviderI::SetRenderBackgroundColor ( uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a 
)
pure virtual

Renderer related.

Set the drawing colour.