Scarab
A thin, game-agnostic 2D engine host built on the sunlight tile-map engine
Loading...
Searching...
No Matches
Scarab::Engine Namespace Reference

Namespaces

namespace  Lua
 

Classes

class  IRendererProvider
 Where the Lua bridge gets the renderer from. More...
 
class  SpritePool
 Generic, game-agnostic fixed-capacity sprite pool. Sprite types are registered up-front with a fixed capacity (. More...
 

Typedefs

typedef uint32_t 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 MakeSpriteHandle (uint32_t nIndex, uint16_t nGeneration)
 
int32_t SpriteHandleIndex (SpriteHandle handle)
 
uint16_t SpriteHandleGeneration (SpriteHandle handle)
 
void * PackSpriteHandleAsPtr (SpriteHandle handle)
 
bool IsPackedSpriteHandle (void *pPtr)
 
SpriteHandle UnpackSpriteHandleFromPtr (void *pPtr)
 

Variables

const SpriteHandle INVALID_SPRITE_HANDLE = 0
 
const uintptr_t SPRITE_HANDLE_PTR_TAG = 0xDEADBEEF00000000ULL
 

Typedef Documentation

◆ SpriteHandle

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.

Function Documentation

◆ IsPackedSpriteHandle()

bool Scarab::Engine::IsPackedSpriteHandle ( void *  pPtr)
inline

◆ MakeSpriteHandle()

SpriteHandle Scarab::Engine::MakeSpriteHandle ( uint32_t  nIndex,
uint16_t  nGeneration 
)
inline

◆ PackSpriteHandleAsPtr()

void * Scarab::Engine::PackSpriteHandleAsPtr ( SpriteHandle  handle)
inline

◆ SpriteHandleGeneration()

uint16_t Scarab::Engine::SpriteHandleGeneration ( SpriteHandle  handle)
inline

◆ SpriteHandleIndex()

int32_t Scarab::Engine::SpriteHandleIndex ( SpriteHandle  handle)
inline

◆ UnpackSpriteHandleFromPtr()

SpriteHandle Scarab::Engine::UnpackSpriteHandleFromPtr ( void *  pPtr)
inline

Variable Documentation

◆ INVALID_SPRITE_HANDLE

const SpriteHandle Scarab::Engine::INVALID_SPRITE_HANDLE = 0

◆ SPRITE_HANDLE_PTR_TAG

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