24 lines
1.1 KiB
C
24 lines
1.1 KiB
C
#ifndef FRAME_SHEET_H
|
|
#define FRAME_SHEET_H
|
|
#include <SDL2/SDL.h>
|
|
#include <SDL2/SDL_opengl.h>
|
|
/*
|
|
FrameSheet(s) are what manage the loading and rendering of Animations. loadFrameSheet handles the loading in of all images within the given directory into SDL_Surface(s).
|
|
when openFrameSheet is called, all surfaces are loaded into textures and the state is set to 1.
|
|
when closeFrameSheet is called, all textures are unloaded and the state is set to 0
|
|
when renderFrame is called, and state is 1, the given frame's texture is rendered to the screen
|
|
*/
|
|
struct FrameSheet {
|
|
int count; // count of surfaces
|
|
int state; // 0 = closed, 1 = open
|
|
SDL_Surface **surfaces; // surface for each image
|
|
GLuint *textures; // texture mapped to each surface
|
|
};
|
|
struct FrameSheet *newFrameSheet();
|
|
int freeFrameSheet(struct FrameSheet *sheet);
|
|
struct FrameSheet *loadFrameSheet(const char *name, const char *framedir);
|
|
int openFrameSheet(struct FrameSheet *sheet);
|
|
int closeFrameSheet(struct FrameSheet *sheet);
|
|
int renderFrame(struct FrameSheet *sheet, int frame, int x, int y);
|
|
#endif
|