yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
null_renderer.h
Go to the documentation of this file.
1// null_renderer.h - Null Renderer Implementation (Headless)
2
3#ifndef YAZE_APP_GFX_BACKEND_NULL_RENDERER_H_
4#define YAZE_APP_GFX_BACKEND_NULL_RENDERER_H_
5
7#include "util/log.h"
8
9namespace yaze {
10namespace gfx {
11
16class NullRenderer : public IRenderer {
17 public:
18 NullRenderer() = default;
19 ~NullRenderer() override = default;
20
21 bool Initialize(SDL_Window* window) override {
22 LOG_INFO("NullRenderer", "Initialized headless renderer");
23 return true;
24 }
25
26 void Shutdown() override {
27 LOG_INFO("NullRenderer", "Shutdown headless renderer");
28 }
29
30 TextureHandle CreateTexture(int width, int height) override {
31 return nullptr;
32 }
33
35 uint32_t format,
36 int access) override {
37 return nullptr;
38 }
39
40 void UpdateTexture(TextureHandle texture, const Bitmap& bitmap) override {
41 // No-op
42 }
43
44 void DestroyTexture(TextureHandle texture) override {
45 // No-op
46 }
47
48 bool LockTexture(TextureHandle texture, SDL_Rect* rect, void** pixels,
49 int* pitch) override {
50 return false;
51 }
52
53 void UnlockTexture(TextureHandle texture) override {
54 // No-op
55 }
56
57 void Clear() override {
58 // No-op
59 }
60
61 void Present() override {
62 // No-op
63 }
64
65 void RenderCopy(TextureHandle texture, const SDL_Rect* srcrect,
66 const SDL_Rect* dstrect) override {
67 // No-op
68 }
69
70 void SetRenderTarget(TextureHandle texture) override {
71 // No-op
72 }
73
74 void SetDrawColor(SDL_Color color) override {
75 // No-op
76 }
77
78 void* GetBackendRenderer() override {
79 return nullptr;
80 }
81};
82
83} // namespace gfx
84} // namespace yaze
85
86#endif // YAZE_APP_GFX_BACKEND_NULL_RENDERER_H_
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:67
Defines an abstract interface for all rendering operations.
Definition irenderer.h:60
Null implementation of the renderer for headless mode.
bool LockTexture(TextureHandle texture, SDL_Rect *rect, void **pixels, int *pitch) override
void Shutdown() override
Shuts down the renderer and releases all associated resources.
void Present() override
Presents the back buffer to the screen, making the rendered content visible.
void UpdateTexture(TextureHandle texture, const Bitmap &bitmap) override
Updates a texture with the pixel data from a Bitmap.
void SetRenderTarget(TextureHandle texture) override
Sets the render target for subsequent drawing operations.
TextureHandle CreateTextureWithFormat(int width, int height, uint32_t format, int access) override
Creates a new texture with a specific pixel format.
void * GetBackendRenderer() override
Provides an escape hatch to get the underlying, concrete renderer object.
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 DestroyTexture(TextureHandle texture) override
Destroys a texture and frees its associated resources.
void Clear() override
Clears the entire render target with the current draw color.
void UnlockTexture(TextureHandle texture) override
bool Initialize(SDL_Window *window) override
Initializes the renderer with a given window.
~NullRenderer() override=default
void SetDrawColor(SDL_Color color) override
Sets the color used for drawing operations (e.g., Clear).
TextureHandle CreateTexture(int width, int height) override
Creates a new, empty texture.
#define LOG_INFO(category, format,...)
Definition log.h:105
void * TextureHandle
An abstract handle representing a texture.
Definition irenderer.h:47