-
Notifications
You must be signed in to change notification settings - Fork 0
cScene
A struct holding arrays of cSprites, c2DModels, cResources, cTexts, and a cCamera.
SDL_Color
Holds the background color.
cCamera*
Holds the camera used for all drawing operations.
cSprite**
Holds an array of cSprite*s to be drawn.
int
The length of sprites.
c2DModel**
Holds an array of c2DModel*s to be drawn.
int
The length of models.
cResource**
Holds an array of cResource*s to be drawn.
int
The length of resources.
cText**
Holds an array of cText*s to be drawn.
int
The length of strings.
void initCScene(cScene* scenePtr, SDL_Color bgColor, cCamera* camera, cSprite* sprites[], int spriteCount, c2DModel* models[], int modelCount, cResource* resources[], int resCount, cText* strings[], int stringCount)
Initializes a scene passing a background color, camera, sprite array and length, model array and length, resource array and length, and text array and length.
int addSpriteToCScene(cScene* scenePtr, cSprite* sprite)
Adds a sprite to a cScene.
int removeSpriteFromCScene(cScene* scenePtr, cSprite* sprite, int index, bool free)
Removes a sprite from a cScene. If sprite is not NULL, it will be used instead of index to search for the sprite to remove. Otherwise, passing the index of the sprite in the cScene to index will remove that sprite. If true is given for free, the memory of that cSprite will be freed; only set this flag if you aren't going to use the sprite removed anymore.
int add2DModelToCScene(cScene* scenePtr, c2DModel* model)
Adds a model to a cScene.
int remove2DModelFromCScene(cScene* scenePtr, c2DModel* model, int index, bool free)
Removes a model from a cScene. If model is not NULL, it will be used instead of index to search for the model to remove. Otherwise, passing the index of the model in the cScene to index will remove that model. If true is given for free, the memory of that c2DModel will be freed; only set this flag if you aren't going to use the model removed anymore.
int addTextToCScene(cScene* scenePtr, cText* text)
Adds a text element to a cScene.
int removeTextFromCScene(cScene* scenePtr, cText* text, int index, bool free)
Removes a text element from a cScene. If text is not NULL, it will be used instead of index to search for the text to remove. Otherwise, passing the index of the text in the cScene to index will remove that text. If true is given for free, the memory of that cText will be freed; only set this flag if you aren't going to use the text removed anymore.
int addResourceToCScene(cScene* scenePtr, cResource* resource)
Adds a custom resource to a cScene.
int removeResourceFromCScene(cScene* scenePtr, cResource* resource, int index, bool free)
Removes a resource from a cScene. If resource is not NULL, it will be used instead of index to search for the resource to remove. Otherwise, passing the index of the resource in the cScene to index will remove that resource. If true is given for free, the memory of that cResource will be freed; only set this flag if you aren't going to use the resource removed anymore.
void destroyCScene(cScene* scenePtr)
Destroys a cScene, clearing all of the memory of all of the sprites, models, texts, and resources.
void drawCScene(cScene* scenePtr, bool clearScreen, bool redraw, int* frameCount, int* fps, int fpsCap)
Draws a cScene. If clearScreen is set to true, the screen is cleared before drawing. Otherwise, it isn't cleared, allowing render draws to happen before this is called. If redraw is set to true, the renderer will be displayed to the screen, and everything will be presented on the screen. Otherwise, the screen remains what it was previously, allowing render draws to happen after this is called.
One frame is counted as one drawCScene() call where redraw is set to true. If frameCount is a non-null pointer to an int, then the frame count will be written into that integer. If fps is a non-null pointer to an int, then the amount of frames/second (rounded down) in a loop containing a drawCScene() call will be stored in the int pointed to. If fps is NULL, then the calculation and storage is skipped. If fpsCap is non-zero, then the function will wait (pausing execution) when necessary in order to ensure that frames are not drawn more than fpsCap times per second, roughly.