Function TRAP::Graphics::SpriteManager::CreateFromCoords#
Function Documentation#
-
TRAP::Ref<SubTexture2D> TRAP::Graphics::SpriteManager::CreateFromCoords(const std::string &name, const Ref<TRAP::Graphics::Texture> &texture, const TRAP::Math::Vec2 &coords, const TRAP::Math::Vec2 &cellSize, const TRAP::Math::Vec2 &spriteSize = {1.0f, 1.0f})#
Create a sprite from a texture and the given coordinates and sprite size.
- Parameters:
name – Name for the sprite.
texture – Sprite sheet texture.
coords – The coordinates for the sub texture.
cellSize – Size the sprite in pixels (16x16 for example).
spriteSize – Optional: Multiplier for the cell size (allows to use multi cell sprites as a single sprite).
- Returns:
Created sprite on success, nullptr otherwise.