yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
metal_renderer.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace yaze {
6namespace gfx {
7
8class MetalRenderer final : public IRenderer {
9 public:
10 MetalRenderer() = default;
11 ~MetalRenderer() override;
12
13 bool Initialize(SDL_Window* window) override;
14 void Shutdown() override;
15
16 TextureHandle CreateTexture(int width, int height) override;
17 TextureHandle CreateTextureWithFormat(int width, int height, uint32_t format,
18 int access) override;
19 void UpdateTexture(TextureHandle texture, const Bitmap& bitmap) override;
20 void DestroyTexture(TextureHandle texture) override;
21 bool LockTexture(TextureHandle texture, SDL_Rect* rect, void** pixels,
22 int* pitch) override;
23 void UnlockTexture(TextureHandle texture) override;
24
25 void Clear() override;
26 void Present() override;
27 void RenderCopy(TextureHandle texture, const SDL_Rect* srcrect,
28 const SDL_Rect* dstrect) override;
29 void SetRenderTarget(TextureHandle texture) override;
30 void SetDrawColor(SDL_Color color) override;
31 void* GetBackendRenderer() override;
32
33 void SetMetalView(void* view);
34
35 private:
36 void* metal_view_ = nullptr;
37 void* command_queue_ = nullptr;
39};
40
41} // namespace gfx
42} // namespace yaze
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:67
Defines an abstract interface for all rendering operations.
Definition irenderer.h:40
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 Shutdown() override
Shuts down the renderer and releases all associated resources.
TextureHandle CreateTexture(int width, int height) override
Creates a new, empty texture.
bool Initialize(SDL_Window *window) override
Initializes the renderer with a given window.
void SetMetalView(void *view)
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 DestroyTexture(TextureHandle texture) override
Destroys a texture and frees its associated resources.
void UpdateTexture(TextureHandle texture, const Bitmap &bitmap) override
Updates a texture with the pixel data from a Bitmap.
void Present() override
Presents the back buffer to the screen, making the rendered content visible.
void UnlockTexture(TextureHandle texture) override
void * GetBackendRenderer() override
Provides an escape hatch to get the underlying, concrete renderer object.
void SetDrawColor(SDL_Color color) override
Sets the color used for drawing operations (e.g., Clear).
void Clear() override
Clears the entire render target with the current draw color.
bool LockTexture(TextureHandle texture, SDL_Rect *rect, void **pixels, int *pitch) override
void * TextureHandle
An abstract handle representing a texture.
Definition irenderer.h:27