Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::CSpriteFrame Class Reference

The object class holds data on an image, including the locations of sprites and frames on it. More...

#include <Graphics2D/SpriteFrame/CSpriteFrame.h>

Inheritance diagram for Skylicht::CSpriteFrame:
Skylicht::CGlyphFont Skylicht::CSpriteAtlas Skylicht::CSpriteFont

Public Member Functions

bool load (const char *fileName)
std::vector< SFrame * > & getFrames ()
SFramegetFrameByName (const char *name)
SFramegetFrameById (const char *id)
const char * getId ()
const char * getPath ()

Protected Attributes

std::vector< SImage * > m_images
std::vector< SFrame * > m_frames
std::vector< SModuleRect * > m_modules
std::map< std::string, SFrame * > m_names
std::map< std::string, SFrame * > m_ids
bool m_deleteAtlas
std::string m_id
std::string m_path

Detailed Description

The object class holds data on an image, including the locations of sprites and frames on it.

You can use the Skylicht-Editor to combine multiple image files into a single sprite file to optimize drawing calls. Use the CGraphics2D object or the CGUISprite, CGUIFitSprite to draw this sprite and image.

Skylicht-Editor

You can create a .sprite from the Asset/Create/Sprite menu.

Editing .sprite properties

Next, select the .sprite file and fill in its details.
  • Width, Height: These properties define the output image size, which is the result of the sprite atlas.
  • Image Folders: Input the Count, then drag Folder Items from your Assets to this property.

Export .spritedata

Next, press the Export button to see the resulting .sprite and .png files.
CSpriteFrame* sprite = CSpriteManager::getInstance()->loadSprite("Assets/SampleGUI/SampleGUI.spritedata");
See also
CGUIFitSprite, CGUISprite

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