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"
|
2023-01-02 07:55:26 -06:00
|
|
|
#include "texture.h"
|
2023-05-24 20:45:50 -05:00
|
|
|
#include "HandmadeMath.h"
|
|
|
|
#include "render.h"
|
2023-11-30 10:47:59 -06:00
|
|
|
#include "transform.h"
|
2021-11-30 21:29:18 -06:00
|
|
|
|
|
|
|
struct datastream;
|
2022-11-19 17:13:57 -06:00
|
|
|
struct gameobject;
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-11-17 16:48:20 -06:00
|
|
|
struct sprite {
|
2023-11-30 10:47:59 -06:00
|
|
|
transform2d t;
|
2023-09-14 17:37:04 -05:00
|
|
|
struct rgba color;
|
2023-11-21 01:07:50 -06:00
|
|
|
struct rgba emissive;
|
2023-09-14 17:37:04 -05:00
|
|
|
int go; /* id of gameobject */
|
|
|
|
struct Texture *tex;
|
|
|
|
struct glrect frame;
|
|
|
|
int enabled;
|
|
|
|
int layer;
|
|
|
|
int next;
|
2021-11-30 21:29:18 -06:00
|
|
|
};
|
|
|
|
|
2023-01-12 17:41:54 -06:00
|
|
|
int make_sprite(int go);
|
|
|
|
struct sprite *id2sprite(int id);
|
|
|
|
void sprite_delete(int id);
|
2023-01-17 13:04:08 -06:00
|
|
|
void sprite_enabled(int id, int e);
|
2022-11-17 16:48:20 -06:00
|
|
|
void sprite_io(struct sprite *sprite, FILE *f, int read);
|
2023-03-05 22:05:22 -06:00
|
|
|
void sprite_loadtex(struct sprite *sprite, const char *path, struct glrect rect);
|
2022-11-17 16:48:20 -06:00
|
|
|
void sprite_settex(struct sprite *sprite, struct Texture *tex);
|
2023-01-18 17:15:36 -06:00
|
|
|
void sprite_setanim(struct sprite *sprite, struct TexAnim *anim, int frame);
|
2023-01-18 14:43:07 -06:00
|
|
|
void sprite_setframe(struct sprite *sprite, struct glrect *frame);
|
2022-02-06 10:14:57 -06:00
|
|
|
void sprite_initialize();
|
2022-11-17 16:48:20 -06:00
|
|
|
void sprite_draw(struct sprite *sprite);
|
2022-07-01 11:14:43 -05:00
|
|
|
void sprite_draw_all();
|
2022-11-17 16:48:20 -06:00
|
|
|
unsigned int incrementAnimFrame(unsigned int interval, struct sprite *sprite);
|
2023-05-07 19:47:49 -05:00
|
|
|
void sprite_flush();
|
2022-08-12 14:03:56 -05:00
|
|
|
|
2023-11-30 10:47:59 -06:00
|
|
|
void gui_draw_img(const char *img, transform2d t, int wrap, HMM_Vec2 wrapoffset, float wrapscale, struct rgba color);
|
2022-12-24 13:18:06 -06:00
|
|
|
|
2021-11-30 21:29:18 -06:00
|
|
|
#endif
|