Scarab
A thin, game-agnostic 2D engine host built on the sunlight tile-map engine
Loading...
Searching...
No Matches
spritehandle.h File Reference
#include <cstdint>
Include dependency graph for spritehandle.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Scarab
 
namespace  Scarab::Engine
 

Typedefs

typedef uint32_t Scarab::Engine::SpriteHandle
 Opaque handle to a sprite pool slot. Packs a slot index (low 16 bits, 1-based so 0 stays reserved for "invalid") and a generation counter (high 16 bits) that's bumped every time a slot is released, so a stale handle referencing an already-recycled slot fails to resolve instead of silently addressing the wrong sprite.
 

Functions

SpriteHandle Scarab::Engine::MakeSpriteHandle (uint32_t nIndex, uint16_t nGeneration)
 
int32_t Scarab::Engine::SpriteHandleIndex (SpriteHandle handle)
 
uint16_t Scarab::Engine::SpriteHandleGeneration (SpriteHandle handle)
 
void * Scarab::Engine::PackSpriteHandleAsPtr (SpriteHandle handle)
 
bool Scarab::Engine::IsPackedSpriteHandle (void *pPtr)
 
SpriteHandle Scarab::Engine::UnpackSpriteHandleFromPtr (void *pPtr)
 

Variables

const SpriteHandle Scarab::Engine::INVALID_SPRITE_HANDLE = 0
 
const uintptr_t Scarab::Engine::SPRITE_HANDLE_PTR_TAG = 0xDEADBEEF00000000ULL