cmdfx 0.3.2
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
20{
24namespace Canvas
25{
26int getWidth() {
27 return Canvas_getWidth();
28}
29int getHeight() {
30 return Canvas_getHeight();
31}
32void clearScreen() {
34}
35void setCursor(int x, int y) {
36 Canvas_setCursor(x, y);
37}
38int getCursorX() {
39 return Canvas_getCursorX();
40}
41int getCursorY() {
42 return Canvas_getCursorY();
43}
44void hideCursor() {
46}
47void showCursor() {
49}
50int isCursorVisible() {
52}
53void setChar(int x, int y, char c) {
54 Canvas_setChar(x, y, c);
55}
56void setAnsiCurrent(const char* ansi) {
58}
59void setAnsiCurrent(const std::string& ansi) {
60 Canvas_setAnsiCurrent(ansi.c_str());
61}
62void setAnsi(int x, int y, const char* ansi) {
63 Canvas_setAnsi(x, y, ansi);
64}
65void setAnsi(int x, int y, const std::string& ansi) {
66 Canvas_setAnsi(x, y, ansi.c_str());
67}
68void rect(int x, int y, int width, int height, char c) {
69 Canvas_rect(x, y, width, height, c);
70}
71void fillRect(int x, int y, int width, int height, char c) {
72 Canvas_fillRect(x, y, width, height, c);
73}
74void circle(int x, int y, int radius, char c) {
75 Canvas_circle(x, y, radius, c);
76}
77void fillCircle(int x, int y, int radius, char c) {
78 Canvas_fillCircle(x, y, radius, c);
79}
80void ellipse(int x, int y, int xradius, int yradius, char c) {
81 Canvas_ellipse(x, y, xradius, yradius, c);
82}
83void fillEllipse(int x, int y, int xradius, int yradius, char c) {
84 Canvas_fillEllipse(x, y, xradius, yradius, c);
85}
86void arc(
87 int x, int y, int rx, int ry, double xrot, int arcflag, int sweepflag,
88 int dx, int dy, char c
89) {
90 Canvas_arc(x, y, rx, ry, xrot, arcflag, sweepflag, dx, dy, c);
91}
92void drawText(int x, int y, char* text) {
93 Canvas_drawText(x, y, text);
94}
95void drawText(int x, int y, const std::string& text) {
96 Canvas_drawText(x, y, const_cast<char*>(text.c_str()));
97}
98void drawAscii(int x, int y, char ascii[8][5]) {
99 Canvas_drawAscii(x, y, ascii);
100}
101void drawAsciiText(int x, int y, char c, const char* text) {
102 Canvas_drawAsciiText(x, y, c, text);
103}
104}; // namespace Canvas
105} // namespace CmdFX
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:25
Primary namespace for CmdFX.
Definition cmdfx.hpp:26