yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::gfx::NullRenderer Class Reference

Null implementation of the renderer for headless mode. More...

#include <null_renderer.h>

Inheritance diagram for yaze::gfx::NullRenderer:
Collaboration diagram for yaze::gfx::NullRenderer:

Public Member Functions

 NullRenderer ()=default
 
 ~NullRenderer () override=default
 
bool Initialize (SDL_Window *window) override
 Initializes the renderer with a given window.
 
void Shutdown () override
 Shuts down the renderer and releases all associated resources.
 
TextureHandle CreateTexture (int width, int height) override
 Creates a new, empty texture.
 
TextureHandle CreateTextureWithFormat (int width, int height, uint32_t format, int access) override
 Creates a new texture with a specific pixel format.
 
void UpdateTexture (TextureHandle texture, const Bitmap &bitmap) override
 Updates a texture with the pixel data from a Bitmap.
 
void DestroyTexture (TextureHandle texture) override
 Destroys a texture and frees its associated resources.
 
bool LockTexture (TextureHandle texture, SDL_Rect *rect, void **pixels, int *pitch) override
 
void UnlockTexture (TextureHandle texture) override
 
void Clear () override
 Clears the entire render target with the current draw color.
 
void Present () override
 Presents the back buffer to the screen, making the rendered content visible.
 
void RenderCopy (TextureHandle texture, const SDL_Rect *srcrect, const SDL_Rect *dstrect) override
 Copies a portion of a texture to the current render target.
 
void SetRenderTarget (TextureHandle texture) override
 Sets the render target for subsequent drawing operations.
 
void SetDrawColor (SDL_Color color) override
 Sets the color used for drawing operations (e.g., Clear).
 
void * GetBackendRenderer () override
 Provides an escape hatch to get the underlying, concrete renderer object.
 
- Public Member Functions inherited from yaze::gfx::IRenderer
virtual ~IRenderer ()=default
 

Detailed Description

Null implementation of the renderer for headless mode.

Definition at line 16 of file null_renderer.h.

Constructor & Destructor Documentation

◆ NullRenderer()

yaze::gfx::NullRenderer::NullRenderer ( )
default

◆ ~NullRenderer()

yaze::gfx::NullRenderer::~NullRenderer ( )
overridedefault

Member Function Documentation

◆ Initialize()

bool yaze::gfx::NullRenderer::Initialize ( SDL_Window * window)
inlineoverridevirtual

Initializes the renderer with a given window.

Parameters
windowA pointer to the SDL_Window to render into.
Returns
True if initialization was successful, false otherwise.

Implements yaze::gfx::IRenderer.

Definition at line 21 of file null_renderer.h.

References LOG_INFO.

◆ Shutdown()

void yaze::gfx::NullRenderer::Shutdown ( )
inlineoverridevirtual

Shuts down the renderer and releases all associated resources.

Implements yaze::gfx::IRenderer.

Definition at line 26 of file null_renderer.h.

References LOG_INFO.

◆ CreateTexture()

TextureHandle yaze::gfx::NullRenderer::CreateTexture ( int width,
int height )
inlineoverridevirtual

Creates a new, empty texture.

Parameters
widthThe width of the texture in pixels.
heightThe height of the texture in pixels.
Returns
An abstract TextureHandle to the newly created texture, or nullptr on failure.

Implements yaze::gfx::IRenderer.

Definition at line 30 of file null_renderer.h.

◆ CreateTextureWithFormat()

TextureHandle yaze::gfx::NullRenderer::CreateTextureWithFormat ( int width,
int height,
uint32_t format,
int access )
inlineoverridevirtual

Creates a new texture with a specific pixel format.

Parameters
widthThe width of the texture in pixels.
heightThe height of the texture in pixels.
formatThe SDL pixel format (e.g., SDL_PIXELFORMAT_ARGB8888).
accessThe texture access pattern (e.g., SDL_TEXTUREACCESS_STREAMING).
Returns
An abstract TextureHandle to the newly created texture, or nullptr on failure.

Implements yaze::gfx::IRenderer.

Definition at line 34 of file null_renderer.h.

◆ UpdateTexture()

void yaze::gfx::NullRenderer::UpdateTexture ( TextureHandle texture,
const Bitmap & bitmap )
inlineoverridevirtual

Updates a texture with the pixel data from a Bitmap.

Parameters
textureThe handle of the texture to update.
bitmapThe Bitmap containing the new pixel data.

Implements yaze::gfx::IRenderer.

Definition at line 40 of file null_renderer.h.

◆ DestroyTexture()

void yaze::gfx::NullRenderer::DestroyTexture ( TextureHandle texture)
inlineoverridevirtual

Destroys a texture and frees its associated resources.

Parameters
textureThe handle of the texture to destroy.

Implements yaze::gfx::IRenderer.

Definition at line 44 of file null_renderer.h.

◆ LockTexture()

bool yaze::gfx::NullRenderer::LockTexture ( TextureHandle texture,
SDL_Rect * rect,
void ** pixels,
int * pitch )
inlineoverridevirtual

Implements yaze::gfx::IRenderer.

Definition at line 48 of file null_renderer.h.

◆ UnlockTexture()

void yaze::gfx::NullRenderer::UnlockTexture ( TextureHandle texture)
inlineoverridevirtual

Implements yaze::gfx::IRenderer.

Definition at line 53 of file null_renderer.h.

◆ Clear()

void yaze::gfx::NullRenderer::Clear ( )
inlineoverridevirtual

Clears the entire render target with the current draw color.

Implements yaze::gfx::IRenderer.

Definition at line 57 of file null_renderer.h.

◆ Present()

void yaze::gfx::NullRenderer::Present ( )
inlineoverridevirtual

Presents the back buffer to the screen, making the rendered content visible.

Implements yaze::gfx::IRenderer.

Definition at line 61 of file null_renderer.h.

◆ RenderCopy()

void yaze::gfx::NullRenderer::RenderCopy ( TextureHandle texture,
const SDL_Rect * srcrect,
const SDL_Rect * dstrect )
inlineoverridevirtual

Copies a portion of a texture to the current render target.

Parameters
textureThe source texture handle.
srcrectA pointer to the source rectangle, or nullptr for the entire texture.
dstrectA pointer to the destination rectangle, or nullptr for the entire render target.

Implements yaze::gfx::IRenderer.

Definition at line 65 of file null_renderer.h.

◆ SetRenderTarget()

void yaze::gfx::NullRenderer::SetRenderTarget ( TextureHandle texture)
inlineoverridevirtual

Sets the render target for subsequent drawing operations.

Parameters
textureThe texture to set as the render target, or nullptr to set it back to the default (the window).

Implements yaze::gfx::IRenderer.

Definition at line 70 of file null_renderer.h.

◆ SetDrawColor()

void yaze::gfx::NullRenderer::SetDrawColor ( SDL_Color color)
inlineoverridevirtual

Sets the color used for drawing operations (e.g., Clear).

Parameters
colorThe SDL_Color to use.

Implements yaze::gfx::IRenderer.

Definition at line 74 of file null_renderer.h.

◆ GetBackendRenderer()

void * yaze::gfx::NullRenderer::GetBackendRenderer ( )
inlineoverridevirtual

Provides an escape hatch to get the underlying, concrete renderer object.

This is necessary for integrating with third-party libraries like ImGui that are tied to a specific rendering backend (e.g., SDL_Renderer*, ID3D11Device*).

Returns
A void pointer to the backend-specific renderer object. The caller is responsible for casting it to the correct type.

Implements yaze::gfx::IRenderer.

Definition at line 78 of file null_renderer.h.


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