38 Scene(
int width,
int height) {
41 Scene(
int width,
int height,
char c,
char* ansi,
int z) {
44 Scene(std::vector<std::string> data, std::vector<std::vector<std::string>> ansi) {
47 Scene(
char** data,
char*** ansi) {
69 int getWidth()
const {
73 int getHeight()
const {
99 std::vector<std::string> data;
100 for (
int i = 0; i < scene->height; i++) {
101 data.push_back(std::string(scene->data[i]));
106 int setData(
char** data) {
124 std::vector<std::vector<std::string>>
getAnsi() {
125 std::vector<std::vector<std::string>> ansi;
126 for (
int i = 0; i < scene->height; i++) {
127 std::vector<std::string> row;
128 for (
int j = 0; j < scene->width; j++) {
129 row.push_back(std::string(scene->ansiData[i][j]));
136 int setAnsi(
char*** ansi) {
145 int setAnsi(std::vector<std::vector<std::string>> ansi) {
150 int appendAnsi(
char*** ansi) {
164 int setForeground(
int x,
int y,
int width,
int height,
int rgb) {
168 int setForegroundAll(
int rgb) {
172 int setBackground(
int x,
int y,
int width,
int height,
int rgb) {
176 int setBackgroundAll(
int rgb) {
184 int draw(
int x,
int y) {
188 int drawPortion(
int x,
int y,
int sx,
int sy,
int width,
int height) {
192 bool isOnTop()
const {
196 bool isOnTopAt(
int x,
int y)
const {
200 bool isOnBottom()
const {
204 bool isOnBottomAt(
int x,
int y)
const {
212 bool isEmpty()
const {
216 int switchTo(
int x,
int y) {
220 static std::unique_ptr<Scene> getSceneAt(
int x,
int y) {
222 if (foundScene ==
nullptr)
return nullptr;
223 return std::make_unique<Scene>(foundScene);
242 static int drawRegistered(
int uid,
int x,
int y) {
246 static int switchToRegistered(
int uid,
int x,
int y) {
250 static int scroll(
int uid,
int dx,
int dy) {
266 if (scene->uid < 0)
return -1;
278 std::vector<std::unique_ptr<Scene>> scenes;
281 scenes.push_back(std::make_unique<Scene>(drawnScenes[i]));
299 std::vector<std::unique_ptr<Scene>> scenes;
302 scenes.push_back(std::make_unique<Scene>(registeredScenes[i]));
323 return std::make_unique<Scene>(scene);
C++ Extensions for the Builder API.
CmdFX_Scene * getScene()
Get the Scene object associated with this class.
Definition scenes.hpp:59
int scroll(int dx, int dy)
Scrolls the scene by the specified amount.
Definition scenes.hpp:265
int registerScene()
Registers the scene to be drawn on the screen.
Definition scenes.hpp:230
int getUniqueId() const
Gets the unique identifier of the scene.
Definition scenes.hpp:90
int unregisterScene()
Unregisters the scene from being drawn on the screen.
Definition scenes.hpp:238
std::vector< std::string > getData()
Get the data of a scene as a 1D vector of strings.
Definition scenes.hpp:98
std::vector< std::vector< std::string > > getAnsi()
Gets the ANSI data of a scene as a 2D vector of strings.
Definition scenes.hpp:124
int appendAnsi(std::vector< std::vector< std::string > > ansi)
Appends the ANSI data to the current ANSI data of the scene.
Definition scenes.hpp:159
int setData(std::vector< std::string > data)
Sets the data of a scene.
Definition scenes.hpp:115
int setAnsi(std::vector< std::vector< std::string > > ansi)
Sets the ANSI data of a scene.
Definition scenes.hpp:145
int Canvas_getDrawnScenesCount()
Gets the number of scenes that are drawn on the screen.
int Scene_register(CmdFX_Scene *scene)
Registers a scene with the Scene Engine.
int Scene_isOnTopAt(CmdFX_Scene *scene, int x, int y)
Checks if the specified scene is on top at the specified position on the screen.
int Scene_isOnTop(CmdFX_Scene *scene)
Checks if the specified scene is on top of the screen.
int Scene_setBackground(CmdFX_Scene *scene, int x, int y, int width, int height, int rgb)
Fills the background of the scene with the specified RGB color.
int Scene_unregister(CmdFX_Scene *scene)
Unregisters a scene with the Scene Engine.
int Scene_drawRegistered(int uid, int x, int y)
Draws a registered scene at the specified position on the screen.
int Scene_isOnBottomAt(CmdFX_Scene *scene, int x, int y)
Checks if the specified scene is on the bottom at the specified position on the screen.
int Scene_appendAnsiData(CmdFX_Scene *scene, char ***ansiData)
Appends the ANSi data to the current ansi data, setting it if it is not currently set.
CmdFX_Scene * Scene_createFilled(int width, int height, char c, char *ansi, int z)
Creates a filled scene with a specified width, height, and character.
CmdFX_Scene * Scene_createFromData(char **data, char ***ansiData)
Creates a scene from a 2D array of characters and ANSI strings.
int Scene_setBackgroundAll(CmdFX_Scene *scene, int rgb)
Fills the entirety of the background of the scene with the specified RGB color.
int Scene_draw(CmdFX_Scene *scene, int x, int y)
Draws a scene at the specified position on the screen.
int Scene_setData(CmdFX_Scene *scene, char **data)
Sets the data of the scene.
CmdFX_Scene ** Scene_getRegisteredScenes()
Gets a list of all registered scenes.
CmdFX_Scene * Scene_create(int width, int height)
Creates an empty scene with a specified width and height.
int Scene_drawPortion(CmdFX_Scene *scene, int x, int y, int sx, int sy, int width, int height)
Draws a portion of a scene at the specified position on the screen.
struct CmdFX_Scene CmdFX_Scene
Represents a CmdFX Scene.
int Scene_setForeground(CmdFX_Scene *scene, int x, int y, int width, int height, int rgb)
Fills the foreground of the scene with the specified RGB color.
CmdFX_Scene * Scene_getSceneAt(int x, int y)
Gets the scene at the specified position on the screen.
CmdFX_Scene ** Canvas_getDrawnScenes()
Gets a list of all scenes that are drawn on the screen.
int Scene_scroll(int uid, int dx, int dy)
Scrolls the scene by the specified amount.
int Scene_remove(CmdFX_Scene *scene)
Removes a scene from the screen.
int Scene_isOnBottom(CmdFX_Scene *scene)
Checks if the specified scene is on the bottom of the screen.
int Scene_getRegisteredScenesCount()
Gets the number of registered scenes.
int Scene_free(CmdFX_Scene *scene)
Destroys the scene, freeing the memory allocated.
int Scene_setForegroundAll(CmdFX_Scene *scene, int rgb)
Fills the entirety of the foreground of the scene with the specified RGB color.
int Scene_isEmpty(CmdFX_Scene *scene)
Checks if the specified scene is empty.
int Scene_switchTo(CmdFX_Scene *scene, int x, int y)
Removes all of the currently drawn scenes, only leaving this scene.
int Scene_setAnsiData(CmdFX_Scene *scene, char ***ansiData)
Sets the ANSI data of the scene.
CmdFX_Scene * Scene_getRegisteredScene(int uid)
Gets a registered scene by its unique identifier.
int Scene_switchToRegistered(int uid, int x, int y)
Removes all of the currently drawn scenes, only leaving the registered scene with the specified uniqu...
int Scene_clear(CmdFX_Scene *scene)
Clears a scene of its data.
std::vector< std::unique_ptr< Scene > > getRegisteredScenes()
Gets the registered scenes.
Definition scenes.hpp:298
int getRegisteredScenesCount()
Gets the number of registered scenes.
Definition scenes.hpp:311
std::vector< std::unique_ptr< Scene > > getDrawnScenes()
Gets all of the drawn scenes.
Definition scenes.hpp:277
int getDrawnScenesCount()
Gets the number of scenes that are drawn on the screen.
Definition scenes.hpp:290
std::unique_ptr< Scene > getRegisteredScene(int uid)
Gets a registered scene by its unique identifier.
Definition scenes.hpp:320
Primary namespace for CmdFX.
Definition cmdfx.hpp:22
char ** to2DArray(std::vector< std::string > string)
Converts a 1D vector of strings to a 2D array of characters.
Definition builder.hpp:39
char *** to3DArray(std::vector< std::vector< std::string > > string)
Converts a 2D vector of strings to a 3D array of characters.
Definition builder.hpp:55
Represents a CmdFX Scene.
Definition scenes.h:34
int x
Gets the x-coordinate of the scene.
Definition scenes.h:94
int y
Gets the y-coordinate of the scene.
Definition scenes.h:103