cmdfx 1.0.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
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}
104void drawAsciiText(int x, int y, char c, const std::string& text) {
105 Canvas_drawAsciiText(x, y, c, text.c_str());
106}
107void resetFormat() {
109}
110void setForeground(int rgb) {
112}
113void setBackground(int rgb) {
115}
116void setColor8(int color) {
117 Canvas_setColor8(color);
118}
119void setForeground256(int color) {
121}
122void setBackground256(int color) {
124}
125void enableBold() {
127}
128void disableBold() {
130}
131void enableDim() {
133}
134void disableDim() {
136}
137void enableItalic() {
139}
140void disableItalic() {
142}
143void enableUnderline() {
145}
146void disableUnderline() {
148}
149void enableBlink() {
151}
152void disableBlink() {
154}
155void enableInvert() {
157}
158void disableInvert() {
160}
161void enableHidden() {
163}
164void disableHidden() {
166}
167void enableStrikethrough() {
169}
170void disableStrikethrough() {
172}
173void hLine(int x, int y, int width, char c) {
174 Canvas_hLine(x, y, width, c);
175}
176void vLine(int x, int y, int height, char c) {
177 Canvas_vLine(x, y, height, c);
178}
179void line(int x1, int y1, int x2, int y2, char c) {
180 Canvas_line(x1, y1, x2, y2, c);
181}
182void polygon(int x, int y, int sides, int radius, char c) {
183 Canvas_polygon(x, y, sides, radius, c);
184}
185void fillPolygon(int x, int y, int sides, int radius, char c) {
186 Canvas_fillPolygon(x, y, sides, radius, c);
187}
188void quad(int x, int y, int x1, int y1, int x2, int y2, char c) {
189 Canvas_quad(x, y, x1, y1, x2, y2, c);
190}
191void cubic(
192 int x, int y, int x1, int y1, int x2, int y2, int x3, int y3, char c
193) {
194 Canvas_cubic(x, y, x1, y1, x2, y2, x3, y3, c);
195}
196}; // namespace Canvas
197} // namespace CmdFX
Canvas API for drawing shapes and text on the terminal.
void Canvas_disableUnderline()
Disables the underline text attribute.
void Canvas_enableStrikethrough()
Enables the strikethrough text attribute.
void Canvas_enableBlink()
Enables the blink text attribute.
void Canvas_circle(int x, int y, int radius, char c)
Draws a hollow circle.
void Canvas_setColor8(int color)
Sets the color at the current cursor position using the built-in 8-bit color palette.
void Canvas_disableHidden()
Disables the hidden text attribute.
void Canvas_enableBold()
Enables the bold text attribute.
void Canvas_ellipse(int x, int y, int xradius, int yradius, char c)
Draws a hollow ellipse.
void Canvas_disableStrikethrough()
Disables the strikethrough text attribute.
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_setBackground(int rgb)
Sets the background color at the current cursor position.
void Canvas_enableItalic()
Enables the italic text attribute.
void Canvas_setAnsiCurrent(const char *ansi)
Appends the ANSI code at the current cursor position.
void Canvas_hLine(int x, int y, int width, char c)
Draws a horizontal line.
void Canvas_setForeground256(int color)
Sets the foreground color at the current cursor position using the built-in 256-color palette.
void Canvas_drawText(int x, int y, char *text)
Draws text at the current cursor position.
void Canvas_cubic(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3, char c)
Draws a cubic Bezier curve.
void Canvas_setForeground(int rgb)
Sets the foreground color 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_setBackground256(int color)
Sets the background color at the current cursor position using the built-in 256-color palette.
void Canvas_hideCursor()
Hides the cursor.
void Canvas_showCursor()
Shows the cursor.
void Canvas_enableInvert()
Enables the invert text attribute.
void Canvas_line(int x1, int y1, int x2, int y2, char c)
Draws a line between two points.
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_quad(int x, int y, int x1, int y1, int x2, int y2, char c)
Draws a quadratic Bezier curve.
void Canvas_disableBlink()
Disables the blink text attribute.
void Canvas_resetFormat()
Resets all formatting at the current cursor position.
void Canvas_enableDim()
Enables the dim text attribute.
void Canvas_fillPolygon(int x, int y, int sides, int radius, char c)
Fills a polygon with a character.
void Canvas_disableDim()
Disables the dim text attribute.
void Canvas_enableUnderline()
Enables the underline text attribute.
void Canvas_polygon(int x, int y, int sides, int radius, char c)
Draws a polygon.
void Canvas_disableBold()
Disables the bold text attribute.
void Canvas_setCursor(int x, int y)
Sets the cursor position.
void Canvas_clearScreen()
Clears the screen.
void Canvas_disableItalic()
Disables the italic text attribute.
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_vLine(int x, int y, int height, char c)
Draws a vertical line.
void Canvas_enableHidden()
Enables the hidden text attribute.
void Canvas_disableInvert()
Disables the invert text attribute.
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