Function TRAP::Graphics::SpriteManager::CreateFromPixels#

Function Documentation#

TRAP::Ref<SubTexture2D> TRAP::Graphics::SpriteManager::CreateFromPixels(const std::string &name, const Ref<TRAP::Graphics::Texture> &texture, const TRAP::Math::Vec2 &pixelPos, const TRAP::Math::Vec2 &pixelSize, const TRAP::Math::Vec2 &spriteSize = {1.0f, 1.0f})#

Create a 2D sprite from a texture and the given pixel coordinates and size.

Parameters:
  • name – Name for the sprite.

  • texture – Sprite sheet texture.

  • pixelPos – Position of the top-left corner of the sprite.

  • pixelSize – Size of the sprite in pixels

  • spriteSizeOptional: Multiplied for the pixel size (allows to use multi cell sprites as a single sprite).

Returns:

Created sprite on success, nullptr otherwise.