cmdfx 0.2.1
Lightweight game engine for your terminal
Loading...
Searching...
No Matches
CmdFX::Canvas Namespace Reference

C++ wrapper for the CmdFX canvas. More...

Functions

int getWidth ()
 
int getHeight ()
 
void clearScreen ()
 
void setCursor (int x, int y)
 
int getCursorX ()
 
int getCursorY ()
 
void hideCursor ()
 
void showCursor ()
 
int isCursorVisible ()
 
void setChar (int x, int y, char c)
 
void setAnsiCurrent (const char *ansi)
 
void setAnsiCurrent (const std::string &ansi)
 
void setAnsi (int x, int y, const char *ansi)
 
void setAnsi (int x, int y, const std::string &ansi)
 
void rect (int x, int y, int width, int height, char c)
 
void fillRect (int x, int y, int width, int height, char c)
 
void circle (int x, int y, int radius, char c)
 
void fillCircle (int x, int y, int radius, char c)
 
void ellipse (int x, int y, int xradius, int yradius, char c)
 
void fillEllipse (int x, int y, int xradius, int yradius, char c)
 
void arc (int x, int y, int rx, int ry, double xrot, int arcflag, int sweepflag, int dx, int dy, char c)
 
void drawText (int x, int y, char *text)
 
void drawText (int x, int y, const std::string &text)
 
void drawAscii (int x, int y, char ascii[8][5])
 
void drawAsciiText (int x, int y, char c, const char *text)
 
std::vector< std::unique_ptr< Scene > > getDrawnScenes ()
 Gets all of the drawn scenes.
 
int getDrawnScenesCount ()
 Gets the number of scenes that are drawn on the screen.
 
std::vector< std::unique_ptr< Scene > > getRegisteredScenes ()
 Gets the registered scenes.
 
int getRegisteredScenesCount ()
 Gets the number of registered scenes.
 
std::unique_ptr< ScenegetRegisteredScene (int uid)
 Gets a registered scene by its unique identifier.
 
std::vector< std::unique_ptr< Sprite > > getDrawnSprites ()
 Gets all of the drawn sprites.
 
std::unique_ptr< SpritegetSpriteAt (int x, int y)
 Get the Sprite at a specific position.
 
std::vector< std::unique_ptr< Button > > getRegisteredButtons ()
 Gets all registered buttons in the UI manager as a vector of unique_ptr<Button>.
 
int getRegisteredButtonsCount ()
 
std::vector< std::unique_ptr< Button > > getAllButtonsAt (int x, int y)
 
std::unique_ptr< ButtongetButtonAt (int x, int y)
 
void path (const std::string path, char ch)
 Draws a path on the canvas using the specified path string.
 

Detailed Description

C++ wrapper for the CmdFX canvas.

Function Documentation

◆ getDrawnScenes()

std::vector< std::unique_ptr< Scene > > CmdFX::Canvas::getDrawnScenes ( )

Gets all of the drawn scenes.

Returns
A vector of pointers to the drawn scenes.

◆ getDrawnScenesCount()

int CmdFX::Canvas::getDrawnScenesCount ( )

Gets the number of scenes that are drawn on the screen.

Returns
The number of scenes that are drawn on the screen.

◆ getDrawnSprites()

std::vector< std::unique_ptr< Sprite > > CmdFX::Canvas::getDrawnSprites ( )

Gets all of the drawn sprites.

Returns
A vector of pointers to the drawn sprites.

◆ getRegisteredButtons()

std::vector< std::unique_ptr< Button > > CmdFX::Canvas::getRegisteredButtons ( )

Gets all registered buttons in the UI manager as a vector of unique_ptr<Button>.

Returns
A vector of unique_ptr<Button> containing all registered buttons.

◆ getRegisteredScene()

std::unique_ptr< Scene > CmdFX::Canvas::getRegisteredScene ( int uid)

Gets a registered scene by its unique identifier.

Parameters
uidThe unique identifier of the scene to get.
Returns
A unique pointer to the registered scene, or nullptr if the scene was not found.

◆ getRegisteredScenes()

std::vector< std::unique_ptr< Scene > > CmdFX::Canvas::getRegisteredScenes ( )

Gets the registered scenes.

Returns
A vector of pointers to the registered scenes.

◆ getRegisteredScenesCount()

int CmdFX::Canvas::getRegisteredScenesCount ( )

Gets the number of registered scenes.

Returns
The number of registered scenes.

◆ getSpriteAt()

std::unique_ptr< Sprite > CmdFX::Canvas::getSpriteAt ( int x,
int y )

Get the Sprite at a specific position.

Parameters
xThe x coordinate of the sprite.
yThe y coordinate of the sprite.
Returns
A unique pointer to the sprite at the specified position, or nullptr if no sprite is found.

◆ path()

void CmdFX::Canvas::path ( const std::string path,
char ch )
inline

Draws a path on the canvas using the specified path string.

This function interprets the path string as a series of SVG-like commands and draws the corresponding shapes on the canvas. The path string can contain commands for moving to a point, drawing lines, rectangles, ellipses, and curves, as well as closing the path.

Parameters
pathThe path string to draw
chThe character to draw