64 lines
1.4 KiB
C
64 lines
1.4 KiB
C
#ifndef PROSPERON_H
|
|
#define PROSPERON_H
|
|
|
|
#include "cell.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 number2js(JSContext *js, double d);
|
|
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 js2number(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 |