Files
cell/source/sprite.h
John Alanbrook a85b1873dd
Some checks failed
Build and Deploy / package-dist (push) Has been cancelled
Build and Deploy / deploy-itch (push) Has been cancelled
Build and Deploy / deploy-gitea (push) Has been cancelled
Build and Deploy / build-windows (CLANG64) (push) Has been cancelled
Build and Deploy / build-linux (push) Has been cancelled
sprite rework
2025-05-04 11:28:45 -05:00

28 lines
663 B
C

#ifndef SPRITE_H
#define SPRITE_H
#include "HandmadeMath.h"
#include "render.h"
#include "quickjs.h"
struct sprite{
HMM_Vec2 pos; // x,y coordinates of the sprite
HMM_Vec2 center;
HMM_Vec2 skew;
HMM_Vec2 scale;
float rotation;
HMM_Mat2 affine;
JSValue image; // the actual texture resource - perhaps SDL_GPUTexture, or SDL_Texture, or something else ...
rect uv; // pixel coordinates of the sprite on its image
int layer; // layer this sprite draws onto
HMM_Vec4 color; // color in 0-1f
};
typedef struct sprite sprite;
sprite *make_sprite(void);
void sprite_free(JSRuntime *rt, sprite *sprite);
void sprite_apply(sprite *sprite);
#endif