2021-11-30 21:29:18 -06:00
|
|
|
#ifndef SPRITE_H
|
|
|
|
#define SPRITE_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"
|
2023-12-11 08:36:45 -06:00
|
|
|
#include "gameobject.h"
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2023-12-27 14:16:43 -06:00
|
|
|
#define DRAW_SIMPLE 0
|
|
|
|
#define DRAW_TILE 1
|
|
|
|
|
2022-11-17 16:48:20 -06:00
|
|
|
struct sprite {
|
2024-03-13 03:51:44 -05:00
|
|
|
HMM_Vec2 pos;
|
|
|
|
HMM_Vec2 scale;
|
|
|
|
float angle;
|
2023-09-14 17:37:04 -05:00
|
|
|
struct rgba color;
|
2023-11-21 01:07:50 -06:00
|
|
|
struct rgba emissive;
|
2023-12-12 08:46:27 -06:00
|
|
|
gameobject *go;
|
2024-03-13 03:51:44 -05:00
|
|
|
texture *tex;
|
|
|
|
struct rect frame;
|
2023-09-14 17:37:04 -05:00
|
|
|
int enabled;
|
2023-12-27 14:16:43 -06:00
|
|
|
int drawmode;
|
2024-01-01 07:44:43 -06:00
|
|
|
float parallax;
|
2024-03-13 03:51:44 -05:00
|
|
|
unsigned int next;
|
2021-11-30 21:29:18 -06:00
|
|
|
};
|
|
|
|
|
2024-03-13 03:51:44 -05:00
|
|
|
typedef struct sprite sprite;
|
|
|
|
|
|
|
|
sprite *sprite_make();
|
2023-12-11 16:59:59 -06:00
|
|
|
int make_sprite(gameobject *go);
|
2024-03-13 03:51:44 -05:00
|
|
|
void sprite_free(sprite *sprite);
|
2023-01-12 17:41:54 -06:00
|
|
|
void sprite_delete(int id);
|
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();
|
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
|