prosperon/source/engine/sprite.h

50 lines
1.2 KiB
C
Raw Normal View History

2021-11-30 21:29:18 -06:00
#ifndef SPRITE_H
#define SPRITE_H
2022-08-28 22:34:33 -05:00
#include <stdio.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;
2022-11-19 17:13:57 -06:00
struct gameobject;
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 sprite {
2021-11-30 21:29:18 -06:00
mfloat_t pos[2];
mfloat_t size[2];
float rotation;
mfloat_t color[3];
2022-08-12 14:03:56 -05:00
int index;
2021-11-30 21:29:18 -06:00
struct Anim2D anim;
2022-11-19 17:13:57 -06:00
struct gameobject *go;
2022-08-28 22:34:33 -05:00
struct Texture *tex;
2021-11-30 21:29:18 -06:00
};
2022-11-19 17:13:57 -06:00
struct sprite *make_sprite(struct gameobject *go);
void sprite_delete(struct sprite *sprite);
2022-11-19 17:13:57 -06:00
void sprite_init(struct sprite *sprite, struct gameobject *go);
void sprite_io(struct sprite *sprite, FILE *f, int read);
void sprite_loadtex(struct sprite *sprite, const char *path);
void sprite_loadanim(struct sprite *sprite, const char *path, struct Anim2D anim);
void sprite_settex(struct sprite *sprite, struct Texture *tex);
2022-02-06 10:14:57 -06:00
void sprite_initialize();
void sprite_draw(struct sprite *sprite);
void spriteanim_draw(struct sprite *sprite);
2022-06-30 10:31:23 -05:00
void video_draw(struct datastream *ds, mfloat_t pos[2], mfloat_t size[2], float rotate, mfloat_t color[3]);
2022-07-01 11:14:43 -05:00
void sprite_draw_all();
unsigned int incrementAnimFrame(unsigned int interval, struct sprite *sprite);
2021-11-30 21:29:18 -06:00
2022-08-12 14:03:56 -05:00
2021-11-30 21:29:18 -06:00
#endif