![]() |
SpriteEditor
|
Sprite class to preview the constructed Sprite. More...
#include <Sprite.hpp>
Public Member Functions | |
Sprite () | |
Constructor, does nothing. | |
~Sprite () | |
Destructor, does nothing. | |
void | destroy () |
Free all the resources allocated. | |
int | init (std::string filePath, int width, int height, std::string frames, SDL_Renderer *renderer, TTF_Font *font) |
Initialize the object with all the parameters. More... | |
int | loadFile (std::string filePath, SDL_Renderer *renderer, TTF_Font *font) |
Load the sprite from previous saved file. More... | |
int | saveFile (std::string filePath) |
Save the sprite into file with specific format. More... | |
void | render (int x, int y, SDL_Renderer *renderer) |
Render the sprite. More... | |
Public Attributes | |
bool | load |
Whether currently there's a sprite loaded. | |
Sprite class to preview the constructed Sprite.
Windows and Mac use a different path If you have compilation errors, change this as needed.
int Sprite::init | ( | std::string | filePath, |
int | width, | ||
int | height, | ||
std::string | frames, | ||
SDL_Renderer * | renderer, | ||
TTF_Font * | font | ||
) |
Initialize the object with all the parameters.
Frame input is just a number.
Frame input is separated by comma.
Cheat split function.
If there are more than 40 frames, only show 40 and show this message.
int Sprite::loadFile | ( | std::string | filePath, |
SDL_Renderer * | renderer, | ||
TTF_Font * | font | ||
) |
Load the sprite from previous saved file.
After reading all the text, still use the init function.
void Sprite::render | ( | int | x, |
int | y, | ||
SDL_Renderer * | renderer | ||
) |
Render the sprite.
Render the arbitrary frames.
Draw the animated sprite.
If there's more than 40 frames, show the message to tell user that.
int Sprite::saveFile | ( | std::string | filePath | ) |
Save the sprite into file with specific format.
Can only save the sprite into file with specific suffix.