40 Scene(
int width,
int height) {
43 Scene(
int width,
int height,
char c,
char* ansi,
int z) {
47 std::vector<std::string> data,
48 std::vector<std::vector<std::string>> ansi
52 Scene(
char** data,
char*** ansi) {
78 int getWidth()
const {
82 int getHeight()
const {
108 std::vector<std::string> data;
109 for (
int i = 0; i < scene->height; i++) {
110 data.push_back(std::string(scene->data[i]));
115 int setData(
char** data) {
133 std::vector<std::vector<std::string>>
getAnsi() {
134 std::vector<std::vector<std::string>> ansi;
135 for (
int i = 0; i < scene->height; i++) {
136 std::vector<std::string> row;
137 for (
int j = 0; j < scene->width; j++) {
138 row.push_back(std::string(scene->ansiData[i][j]));
145 int setAnsi(
char*** ansi) {
154 int setAnsi(std::vector<std::vector<std::string>> ansi) {
159 int appendAnsi(
char*** ansi) {
173 int setForeground(
int x,
int y,
int width,
int height,
int rgb) {
177 int setForegroundAll(
int rgb) {
181 int setBackground(
int x,
int y,
int width,
int height,
int rgb) {
185 int setBackgroundAll(
int rgb) {
193 int draw(
int x,
int y) {
197 int drawPortion(
int x,
int y,
int sx,
int sy,
int width,
int height) {
201 bool isOnTop()
const {
205 bool isOnTopAt(
int x,
int y)
const {
209 bool isOnBottom()
const {
213 bool isOnBottomAt(
int x,
int y)
const {
221 bool isEmpty()
const {
225 int switchTo(
int x,
int y) {
229 static std::unique_ptr<Scene> getSceneAt(
int x,
int y) {
231 if (foundScene ==
nullptr)
return nullptr;
232 return std::make_unique<Scene>(foundScene);
253 static int drawRegistered(
int uid,
int x,
int y) {
257 static int switchToRegistered(
int uid,
int x,
int y) {
261 static int scroll(
int uid,
int dx,
int dy) {
280 if (scene->uid < 0)
return -1;
293 std::vector<std::unique_ptr<Scene>> scenes;
296 scenes.push_back(std::make_unique<Scene>(drawnScenes[i]));
314 std::vector<std::unique_ptr<Scene>> scenes;
317 scenes.push_back(std::make_unique<Scene>(registeredScenes[i]));
339 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:66
int scroll(int dx, int dy)
Scrolls the scene by the specified amount.
Definition scenes.hpp:279
int registerScene()
Registers the scene to be drawn on the screen.
Definition scenes.hpp:240
int getUniqueId() const
Gets the unique identifier of the scene.
Definition scenes.hpp:99
int unregisterScene()
Unregisters the scene from being drawn on the screen.
Definition scenes.hpp:249
std::vector< std::string > getData()
Get the data of a scene as a 1D vector of strings.
Definition scenes.hpp:107
std::vector< std::vector< std::string > > getAnsi()
Gets the ANSI data of a scene as a 2D vector of strings.
Definition scenes.hpp:133
int appendAnsi(std::vector< std::vector< std::string > > ansi)
Appends the ANSI data to the current ANSI data of the scene.
Definition scenes.hpp:168
int setData(std::vector< std::string > data)
Sets the data of a scene.
Definition scenes.hpp:124
int setAnsi(std::vector< std::vector< std::string > > ansi)
Sets the ANSI data of a scene.
Definition scenes.hpp:154
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:313
int getRegisteredScenesCount()
Gets the number of registered scenes.
Definition scenes.hpp:326
std::vector< std::unique_ptr< Scene > > getDrawnScenes()
Gets all of the drawn scenes.
Definition scenes.hpp:292
int getDrawnScenesCount()
Gets the number of scenes that are drawn on the screen.
Definition scenes.hpp:305
std::unique_ptr< Scene > getRegisteredScene(int uid)
Gets a registered scene by its unique identifier.
Definition scenes.hpp:336
Primary namespace for CmdFX.
Definition cmdfx.hpp:26
char ** to2DArray(std::vector< std::string > string)
Converts a 1D vector of strings to a 2D array of characters.
Definition builder.hpp:64
char *** to3DArray(std::vector< std::vector< std::string > > string)
Converts a 2D vector of strings to a 3D array of characters.
Definition builder.hpp:80
Represents a CmdFX Scene.
Definition scenes.h:35
int x
Gets the x-coordinate of the scene.
Definition scenes.h:100
int y
Gets the y-coordinate of the scene.
Definition scenes.h:110