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
|
|
|
|
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;
|
2024-04-23 15:58:08 -05:00
|
|
|
HMM_Vec2 spritesize;
|
|
|
|
HMM_Vec2 spriteoffset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct spriteuni {
|
|
|
|
HMM_Vec4 color;
|
|
|
|
HMM_Vec4 emissive;
|
|
|
|
HMM_Vec2 size;
|
|
|
|
HMM_Vec2 offset;
|
|
|
|
HMM_Mat4 model;
|
2021-11-30 21:29:18 -06:00
|
|
|
};
|
|
|
|
|
2024-03-13 03:51:44 -05:00
|
|
|
typedef struct sprite sprite;
|
|
|
|
|
2024-04-21 10:05:18 -05:00
|
|
|
extern sg_bindings bind_sprite;
|
|
|
|
|
2024-03-13 03:51:44 -05:00
|
|
|
sprite *sprite_make();
|
|
|
|
void sprite_free(sprite *sprite);
|
2024-04-21 10:05:18 -05:00
|
|
|
void sprite_tex(texture *t);
|
2022-02-06 10:14:57 -06:00
|
|
|
void sprite_initialize();
|
2024-04-21 10:05:18 -05:00
|
|
|
void sprite_draw(struct sprite *sprite, gameobject *go);
|
|
|
|
void sprite_pipe();
|
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
|
|
|
|
2024-03-26 07:53:36 -05:00
|
|
|
void gui_draw_img(texture *tex, 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
|