cmdfx 0.2.1
Lightweight game engine for your terminal
Loading...
Searching...
No Matches
CmdFX::Sprite Class Referencefinal

A C++ wrapper around a CmdFX_Sprite struct. More...

#include <sprites.hpp>

Public Member Functions

 Sprite (CmdFX_Sprite *sprite)
 
 Sprite (char **text, char ***ansi, int z)
 
 Sprite (std::vector< std::string > text, std::vector< std::vector< std::string > > ansi, int z)
 
CmdFX_SpritegetSprite ()
 Get the Sprite object associated with this class.
 
int getX () const
 
int getY () const
 
int getWidth () const
 
int getHeight () const
 
int getZ () const
 
int draw (int x, int y)
 
void remove ()
 
std::vector< std::string > getData ()
 Get the data of a sprite as a 1D vector of strings.
 
void setData (std::vector< std::string > text)
 
void setData (char **text)
 
std::vector< std::vector< std::string > > getAnsi ()
 Get the ANSI data of a sprite as a 2D vector of strings.
 
void setChar (int x, int y, char c)
 
int fillChar (int x, int y, int width, int height, char c)
 
int fillCharEmpty (int x, int y, int width, int height, char c)
 
int fillCharAll (char c)
 
int fillCharAllEmpty (char c)
 
int setAnsi (int x, int y, char *ansi)
 
int appendAnsi (int x, int y, char *ansi)
 
int fillAnsi (int x, int y, char *ansi, int width, int height)
 
int setAnsiAll (char *ansi)
 
int appendAnsiAll (char *ansi)
 
int resize (int width, int height)
 
int resizeWithPadding (int width, int height, char padding)
 
int center ()
 
int resizeAndCenter (int width, int height)
 
void moveTo (int x, int y)
 
void moveBy (int dx, int dy)
 
std::vector< std::unique_ptr< Sprite > > getCollidingSprites ()
 
bool isCollidingWith (std::unique_ptr< Sprite > other)
 
bool isOnTop (int x, int y)
 
bool isOnBottom (int x, int y)
 
int setForeground (int x, int y, int rgb)
 
int setForeground (int rgb)
 
int setForeground256 (int color)
 
int setBackground (int x, int y, int rgb)
 
int rotate (double radians)
 
double getRotationAngle ()
 
int hFlip ()
 
int vFlip ()
 
int scale (double scale)
 
int transpose ()
 

Detailed Description

A C++ wrapper around a CmdFX_Sprite struct.

This class is a wrapper around the CmdFX_Sprite struct. It provides a constructor and destructor for the sprite, as well as a method to get the sprite's data. The destructor will free the sprite's memory when the object is destroyed.

Member Function Documentation

◆ getAnsi()

std::vector< std::vector< std::string > > CmdFX::Sprite::getAnsi ( )
inline

Get the ANSI data of a sprite as a 2D vector of strings.

Returns
The ansi of the sprite.

◆ getData()

std::vector< std::string > CmdFX::Sprite::getData ( )
inline

Get the data of a sprite as a 1D vector of strings.

Returns
The data of the sprite.

◆ getSprite()

CmdFX_Sprite * CmdFX::Sprite::getSprite ( )
inline

Get the Sprite object associated with this class.

Returns
CmdFX_Sprite* The sprite object.

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