cmdfx 0.3.2
Lightweight game engine for your terminal
Loading...
Searching...
No Matches
scenes.h
Go to the documentation of this file.
1
11
12#pragma once
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
26#define MAX_REGISTERED_SCENES 1024
27
35typedef struct CmdFX_Scene {
46 int uid;
54 int width;
62 int height;
76 char** data;
90 char*** ansiData;
100 int x;
110 int y;
118 int z;
120
126
132
148CmdFX_Scene* Scene_create(int width, int height);
149
170 int width, int height, char c, char* ansi, int z
171);
172
194CmdFX_Scene* Scene_createFromData(char** data, char*** ansiData);
195
208
223int Scene_draw(CmdFX_Scene* scene, int x, int y);
224
249 CmdFX_Scene* scene, int x, int y, int sx, int sy, int width, int height
250);
251
269
281
295int Scene_isOnTopAt(CmdFX_Scene* scene, int x, int y);
296
309
325int Scene_isOnBottomAt(CmdFX_Scene* scene, int x, int y);
326
339
350
364int Scene_switchTo(CmdFX_Scene* scene, int x, int y);
365
377
384
390
403
415
427
443int Scene_drawRegistered(int uid, int x, int y);
444
458int Scene_switchToRegistered(int uid, int x, int y);
459
477int Scene_scroll(int uid, int dx, int dy);
478
486
499
511
512// Scene Data Manipulation
513
528int Scene_setData(CmdFX_Scene* scene, char** data);
529
551int Scene_setChar(CmdFX_Scene* scene, int x, int y, char c);
552
567int Scene_setAnsiData(CmdFX_Scene* scene, char*** ansiData);
568
584int Scene_appendAnsiData(CmdFX_Scene* scene, char*** ansiData);
585
603 CmdFX_Scene* scene, int x, int y, int width, int height, int rgb
604);
605
618
636 CmdFX_Scene* scene, int x, int y, int width, int height, int rgb
637);
638
651
652#ifdef __cplusplus
653}
654#endif
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.
void tickCmdFXSceneEngine()
Ticks the CmdFX Scene Engine.
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.
int endCmdFXSceneEngine()
Ends the CmdFX Scene Engine.
int Scene_setChar(CmdFX_Scene *scene, int x, int y, char c)
Sets the character at the specified position in the scene.
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.
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 beginCmdFXSceneEngine()
Begins the CmdFX Scene Engine.
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.
Represents a CmdFX Scene.
Definition scenes.h:35
char ** data
Represents the data of the scene.
Definition scenes.h:76
int z
Represents the Z index of the scene.
Definition scenes.h:118
int uid
The unique identifier for the scene.
Definition scenes.h:46
int x
Gets the x-coordinate of the scene.
Definition scenes.h:100
int width
Represents the width of the scene.
Definition scenes.h:54
int y
Gets the y-coordinate of the scene.
Definition scenes.h:110
int height
Represents the height of the scene.
Definition scenes.h:62
char *** ansiData
Represents the ANSI data of the scene.
Definition scenes.h:90