Files
prosperon/prosperon.h
2025-12-06 12:29:03 -06:00

63 lines
1.3 KiB
C

#ifndef PROSPERON_H
#define PROSPERON_H
#include "cell.h"
#include <SDL3/SDL.h>
#include "HandmadeMath.h"
struct lrtb {
float l;
float r;
float t;
float b;
};
typedef struct lrtb lrtb;
lrtb js2lrtb(JSContext *js, JSValue v);
JSValue lrtb2js(JSContext *js, lrtb r);
struct text_vert {
HMM_Vec2 pos;
HMM_Vec2 uv;
HMM_Vec4 color;
};
typedef struct text_vert text_vert;
JSValue quads_to_mesh(JSContext *js, text_vert *argv);
typedef HMM_Vec4 colorf;
typedef SDL_FRect rect;
typedef SDL_Rect irect;
// Common conversion functions used across modules
JSValue rect2js(JSContext *js, rect r);
JSValue vec22js(JSContext *js, HMM_Vec2 v);
JSValue vec32js(JSContext *js, HMM_Vec3 v);
JSValue vec42js(JSContext *js, HMM_Vec4 v);
JSValue quat2js(JSContext *js, HMM_Quat q);
JSValue color2js(JSContext *js, colorf c);
JSValue angle2js(JSContext *js, double a);
rect js2rect(JSContext *js, JSValue v);
HMM_Vec2 js2vec2(JSContext *js, JSValue v);
HMM_Vec3 js2vec3(JSContext *js, JSValue v);
HMM_Vec4 js2vec4(JSContext *js, JSValue v);
HMM_Quat js2quat(JSContext *js, JSValue v);
colorf js2color(JSContext *js, JSValue v);
double js2angle(JSContext *js, JSValue v);
#define RGBA_MAX 255
struct rgba {
unsigned char r;
unsigned char g;
unsigned char b;
unsigned char a;
};
typedef struct rgba rgba;
float *rgba2floats(float *r, struct rgba c);
#endif