prosperon/source/engine/sprite.h

55 lines
1.2 KiB
C
Raw Normal View History

2021-11-30 21:29:18 -06:00
#ifndef SPRITE_H
#define SPRITE_H
2022-02-06 10:14:57 -06:00
#include "timer.h"
2021-11-30 21:29:18 -06:00
#include "mathc.h"
struct datastream;
struct mGameObject;
2022-01-19 16:43:21 -06:00
struct Texture;
2021-11-30 21:29:18 -06:00
2022-02-06 10:14:57 -06:00
struct timer;
2021-11-30 21:29:18 -06:00
struct Anim2D {
int frames;
int frame;
int dimensions[2];
2022-02-06 10:14:57 -06:00
struct timer *timer;
2021-11-30 21:29:18 -06:00
int ms;
};
struct mSprite {
struct Texture *tex;
mfloat_t pos[2];
mfloat_t size[2];
float rotation;
mfloat_t color[3];
struct Anim2D anim;
struct mGameObject *go;
};
extern struct mSprite *sprites[100];
extern int numSprites;
struct mSprite *MakeSprite(struct mGameObject *go);
void sprite_init(struct mSprite *sprite, struct mGameObject *go);
void sprite_loadtex(struct mSprite *sprite, const char *path);
void sprite_loadanim(struct mSprite *sprite, const char *path,
struct Anim2D anim);
2022-01-19 16:43:21 -06:00
void sprite_settex(struct mSprite *sprite, struct Texture *tex);
2022-02-06 10:14:57 -06:00
void sprite_initialize();
2021-11-30 21:29:18 -06:00
void sprite_draw(struct mSprite *sprite);
void spriteanim_draw(struct mSprite *sprite);
void video_draw(struct datastream *ds, mfloat_t pos[2], mfloat_t size[2],
float rotate, mfloat_t color[3]);
2022-02-06 10:14:57 -06:00
unsigned int incrementAnimFrame(unsigned int interval, struct mSprite *sprite);
2021-11-30 21:29:18 -06:00
2022-01-19 16:43:21 -06:00
struct mSprite *gui_makesprite();
void gui_init();
2021-11-30 21:29:18 -06:00
void sprite_draw_all();
#endif