group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
HudSvgAtlas Class Reference

#include <HudSvgAtlas.hpp>

Classes

struct  CacheKey
struct  CacheKeyHash

Public Member Functions

bool init (SDL_GPUDevice *device, std::filesystem::path assetDir)
void quit ()
std::optional< HudSvgSpritesprite (HudIcon id, int width, int height)
SDL_GPUTexture * texture () const
SDL_GPUSampler * sampler () const

Private Member Functions

bool createGpuResources ()
void resetPacking ()
std::optional< HudSvgSpriteallocate (HudIcon id, int width, int height)
bool uploadSlot (const HudSvgBitmap &bitmap, const HudSvgSprite &sprite)

Private Attributes

SDL_GPUDevice * device_ = nullptr
SDL_GPUTexture * texture_ = nullptr
SDL_GPUSampler * sampler_ = nullptr
std::filesystem::path assetDir_
int cursorX_ = 0
int cursorY_ = 0
int rowH_ = 0
std::unordered_map< CacheKey, HudSvgSprite, CacheKeyHashsprites_

Static Private Attributes

static constexpr int kAtlasSize = 4096
static constexpr int kPadding = 2

Member Function Documentation

◆ allocate()

std::optional< HudSvgSprite > HudSvgAtlas::allocate ( HudIcon id,
int width,
int height )
nodiscardprivate
Here is the caller graph for this function:

◆ createGpuResources()

bool HudSvgAtlas::createGpuResources ( )
nodiscardprivate
Here is the caller graph for this function:

◆ init()

bool HudSvgAtlas::init ( SDL_GPUDevice * device,
std::filesystem::path assetDir )
Here is the call graph for this function:

◆ quit()

void HudSvgAtlas::quit ( )

◆ resetPacking()

void HudSvgAtlas::resetPacking ( )
private
Here is the caller graph for this function:

◆ sampler()

SDL_GPUSampler * HudSvgAtlas::sampler ( ) const
inlinenodiscard

◆ sprite()

std::optional< HudSvgSprite > HudSvgAtlas::sprite ( HudIcon id,
int width,
int height )
nodiscard
Here is the call graph for this function:
Here is the caller graph for this function:

◆ texture()

SDL_GPUTexture * HudSvgAtlas::texture ( ) const
inlinenodiscard

◆ uploadSlot()

bool HudSvgAtlas::uploadSlot ( const HudSvgBitmap & bitmap,
const HudSvgSprite & sprite )
nodiscardprivate
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ assetDir_

std::filesystem::path HudSvgAtlas::assetDir_
private

◆ cursorX_

int HudSvgAtlas::cursorX_ = 0
private

◆ cursorY_

int HudSvgAtlas::cursorY_ = 0
private

◆ device_

SDL_GPUDevice* HudSvgAtlas::device_ = nullptr
private

◆ kAtlasSize

int HudSvgAtlas::kAtlasSize = 4096
staticconstexprprivate

◆ kPadding

int HudSvgAtlas::kPadding = 2
staticconstexprprivate

◆ rowH_

int HudSvgAtlas::rowH_ = 0
private

◆ sampler_

SDL_GPUSampler* HudSvgAtlas::sampler_ = nullptr
private

◆ sprites_

std::unordered_map<CacheKey, HudSvgSprite, CacheKeyHash> HudSvgAtlas::sprites_
private

◆ texture_

SDL_GPUTexture* HudSvgAtlas::texture_ = nullptr
private

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