cmdfx 0.2.1
Lightweight game engine for your terminal
Loading...
Searching...
No Matches
canvas.hpp
Go to the documentation of this file.
1
11#pragma once
12
13#include <string>
14
15extern "C" {
16 #include "cmdfx/core/canvas.h"
17}
18
19namespace CmdFX {
23 namespace Canvas {
24 int getWidth() { return Canvas_getWidth(); }
25 int getHeight() { return Canvas_getHeight(); }
26 void clearScreen() { Canvas_clearScreen(); }
27 void setCursor(int x, int y) { Canvas_setCursor(x, y); }
28 int getCursorX() { return Canvas_getCursorX(); }
29 int getCursorY() { return Canvas_getCursorY(); }
30 void hideCursor() { Canvas_hideCursor(); }
31 void showCursor() { Canvas_showCursor(); }
32 int isCursorVisible() { return Canvas_isCursorVisible(); }
33 void setChar(int x, int y, char c) { Canvas_setChar(x, y, c); }
34 void setAnsiCurrent(const char* ansi) { Canvas_setAnsiCurrent(ansi); }
35 void setAnsiCurrent(const std::string& ansi) { Canvas_setAnsiCurrent(ansi.c_str()); }
36 void setAnsi(int x, int y, const char* ansi) { Canvas_setAnsi(x, y, ansi); }
37 void setAnsi(int x, int y, const std::string& ansi) { Canvas_setAnsi(x, y, ansi.c_str()); }
38 void rect(int x, int y, int width, int height, char c) { Canvas_rect(x, y, width, height, c); }
39 void fillRect(int x, int y, int width, int height, char c) { Canvas_fillRect(x, y, width, height, c); }
40 void circle(int x, int y, int radius, char c) { Canvas_circle(x, y, radius, c); }
41 void fillCircle(int x, int y, int radius, char c) { Canvas_fillCircle(x, y, radius, c); }
42 void ellipse(int x, int y, int xradius, int yradius, char c) { Canvas_ellipse(x, y, xradius, yradius, c); }
43 void fillEllipse(int x, int y, int xradius, int yradius, char c) { Canvas_fillEllipse(x, y, xradius, yradius, c); }
44 void arc(int x, int y, int rx, int ry, double xrot, int arcflag, int sweepflag, int dx, int dy, char c) { Canvas_arc(x, y, rx, ry, xrot, arcflag, sweepflag, dx, dy, c); }
45 void drawText(int x, int y, char* text) { Canvas_drawText(x, y, text); }
46 void drawText(int x, int y, const std::string& text) { Canvas_drawText(x, y, const_cast<char*>(text.c_str())); }
47 void drawAscii(int x, int y, char ascii[8][5]) { Canvas_drawAscii(x, y, ascii); }
48 void drawAsciiText(int x, int y, char c, const char* text) { Canvas_drawAsciiText(x, y, c, text); }
49 };
50}
Canvas API for drawing shapes and text on the terminal.
void Canvas_circle(int x, int y, int radius, char c)
Draws a hollow circle.
void Canvas_ellipse(int x, int y, int xradius, int yradius, char c)
Draws a hollow ellipse.
void Canvas_fillRect(int x, int y, int width, int height, char c)
Fills a rectangle with a character.
void Canvas_setChar(int x, int y, char c)
Sets a character at a specific position.
void Canvas_rect(int x, int y, int width, int height, char c)
Draws a hollow rectangle.
void Canvas_setAnsiCurrent(const char *ansi)
Appends the ANSI code at the current cursor position.
void Canvas_drawText(int x, int y, char *text)
Draws text at the current cursor position.
void Canvas_drawAsciiText(int x, int y, char character, const char *text)
Draws text at a specific position.
void Canvas_hideCursor()
Hides the cursor.
void Canvas_showCursor()
Shows the cursor.
int Canvas_getWidth()
Gets the width of the canvas, which is the width of the terminal.
int Canvas_isCursorVisible()
Gets the cursor visibility.
int Canvas_getCursorX()
Gets the cursor position.
void Canvas_setCursor(int x, int y)
Sets the cursor position.
void Canvas_clearScreen()
Clears the screen.
void Canvas_fillEllipse(int x, int y, int xradius, int yradius, char c)
Fills an ellipse with a character.
int Canvas_getCursorY()
Gets the cursor position.
void Canvas_fillCircle(int x, int y, int radius, char c)
Fills a circle with a character.
void Canvas_setAnsi(int x, int y, const char *ansi)
Appends the ANSI code at a specific position.
int Canvas_getHeight()
Gets the height of the canvas, which is the height of the terminal.
void Canvas_drawAscii(int x, int y, char ascii[8][5])
Draws an ASCII character at a specific position.
void Canvas_arc(int x, int y, int rx, int ry, double xrot, int arcflag, int sweepflag, int dx, int dy, char c)
Draws an elliptical arc.
C++ wrapper for the CmdFX canvas.
Definition canvas.hpp:23
Primary namespace for CmdFX.
Definition cmdfx.hpp:22