1#ifndef YAZE_APP_GFX_ARENA_H
2#define YAZE_APP_GFX_ARENA_H
11#include <unordered_map>
78 SDL_Surface*
AllocateSurface(
int width,
int height,
int depth,
int format);
119 if (i < 0 || i >= 223)
return static_cast<gfx::Bitmap*
>(
nullptr);
142 std::function<void(
const std::string& group_name,
int palette_index)>;
151 int palette_index = -1);
195 std::unique_ptr<SDL_Texture, util::SDL_Texture_Deleter>>
198 std::unordered_map<SDL_Surface*,
199 std::unique_ptr<SDL_Surface, util::SDL_Surface_Deleter>>
211 std::unordered_map<SDL_Surface*, std::tuple<int, int, int, int>>
Resource management arena for efficient graphics memory handling.
size_t GetSurfaceCount() const
std::unordered_map< SDL_Surface *, std::unique_ptr< SDL_Surface, util::SDL_Surface_Deleter > > surfaces_
void Initialize(IRenderer *renderer)
struct yaze::gfx::Arena::TexturePool texture_pool_
SDL_Surface * AllocateSurface(int width, int height, int depth, int format)
std::unordered_map< TextureHandle, std::unique_ptr< SDL_Texture, util::SDL_Texture_Deleter > > textures_
size_t GetPooledSurfaceCount() const
bool HasPendingTextures() const
Check if there are pending textures to process.
auto gfx_sheet(int i)
Get a specific graphics sheet by index.
static constexpr int kTotalTiles
size_t GetTextureCount() const
void QueueTextureCommand(TextureCommandType type, Bitmap *bitmap)
int RegisterPaletteListener(PaletteChangeCallback callback)
Register a callback for palette change notifications.
std::array< uint16_t, kTotalTiles > layer2_buffer_
static constexpr int kTilesPerColumn
size_t GetPooledTextureCount() const
static constexpr int kTilesPerRow
auto mutable_gfx_sheets()
Get mutable reference to all graphics sheets.
std::function< void(const std::string &group_name, int palette_index)> PaletteChangeCallback
void FreeSurface(SDL_Surface *surface)
auto mutable_gfx_sheet(int i)
Get mutable reference to a specific graphics sheet.
void ProcessTextureQueue(IRenderer *renderer)
std::array< gfx::Bitmap, 223 > gfx_sheets_
bool ProcessSingleTexture(IRenderer *renderer)
Process a single texture command for frame-budget-aware loading.
auto & bg2()
Get reference to background layer 2 buffer.
std::array< gfx::Bitmap, 223 > & gfx_sheets()
Get reference to all graphics sheets.
std::unordered_map< int, PaletteChangeCallback > palette_listeners_
std::vector< TextureCommand > texture_command_queue_
std::array< uint16_t, kTotalTiles > layer1_buffer_
void NotifySheetModified(int sheet_index)
Notify Arena that a graphics sheet has been modified.
auto & bg1()
Get reference to background layer 1 buffer.
struct yaze::gfx::Arena::SurfacePool surface_pool_
void UnregisterPaletteListener(int listener_id)
Unregister a palette change listener.
size_t texture_command_queue_size() const
int next_palette_listener_id_
void NotifyPaletteModified(const std::string &group_name, int palette_index=-1)
Notify all listeners that a palette has been modified.
Represents a bitmap image optimized for SNES ROM hacking.
Defines an abstract interface for all rendering operations.
void * TextureHandle
An abstract handle representing a texture.
static constexpr size_t MAX_POOL_SIZE
std::vector< SDL_Surface * > available_surfaces_
std::unordered_map< SDL_Surface *, std::tuple< int, int, int, int > > surface_info_
static constexpr size_t MAX_POOL_SIZE
std::vector< TextureHandle > available_textures_
std::unordered_map< TextureHandle, std::pair< int, int > > texture_sizes_