Blame src/private.h

3f9996
3f9996
#include <assert.h></assert.h>
3f9996
#include <string.h></string.h>
3f9996
#include <stdlib.h></stdlib.h>
8535a3
#include <stdio.h></stdio.h>
3f9996
#include <ctype.h></ctype.h>
3f9996
#include <math.h></math.h>
3f9996
ba9f06
#define GL_GLEXT_PROTOTYPES
f63775
#include <gl gl.h=""></gl>
8535a3
3f9996
#include "common.h"
3f9996
#include "sprite.h"
3954ba
#include "font.h"
3f9996
3f9996
8535a3
// globals
3f9996
1c7488
#define HELI_PRECISION 1e-6
1c7488
#define HELI_PRECISION_SQR 1e-12
1c7488
f63775
f63775
// blobs
f63775
f63775
extern char heliBlobDefaultFont[];
f63775
extern int heliBlobDefaultFontSize;
3f9996
3f9996
3f9996
// string
3f9996
8535a3
char* heliStringCopy(const char *x);
8535a3
char* heliStringConcat3(const char *a, const char *b, const char *c);
8535a3
int heliStringEndsWithLowcase(const char *s, const char *tail);
3f9996
void heliLowercase(char *x);
8535a3
void heliParseColor(const char *x, double *color);
3f9996
09c823
3f9996
// pointer array
3f9996
8535a3
typedef void (*HeliFreeCallback)(void*);
8eb855
typedef void* (*HeliCloneCallback)(const void*);
8eb855
typedef int (*HeliCompareCallback)(const void*, const void*);
8535a3
8535a3
typedef struct _HeliPair {
8535a3
	void *key;
8535a3
	void *value;
8535a3
	HeliFreeCallback freeKey;
8535a3
	HeliFreeCallback freeValue;
8535a3
} HeliPair;
8535a3
3f9996
typedef struct _HeliArray {
8535a3
	HeliPair *items;
3f9996
	int count;
3f9996
	int allocated;
3f9996
} HeliArray;
3f9996
8535a3
void heliPairInit(HeliPair *p);
8535a3
void heliPairDestroy(HeliPair *p);
8535a3
07b70f
void heliArrayInit(HeliArray *a);
8535a3
void heliArrayClear(HeliArray *a);
07b70f
void heliArrayDestroy(HeliArray *a);
8535a3
HeliPair* heliArrayGet(HeliArray *a, int i);
8535a3
void* heliArrayGetKey(HeliArray *a, int i);
8535a3
void* heliArrayGetValue(HeliArray *a, int i);
8535a3
HeliPair* heliArrayInsert(HeliArray *a, int i, void *v, HeliFreeCallback fv);
8eb855
HeliPair* heliArrayInsertPair(HeliArray *a, int i, void *k, HeliFreeCallback fk, void *v, HeliFreeCallback fv);
8535a3
void heliArrayRemove(HeliArray *a, int i);
8535a3
8eb855
HeliPair* heliMapFind(HeliArray *a, const void *k, HeliCompareCallback cmp, int *gtOrEqIndex);
8eb855
HeliPair* heliMapGet(HeliArray *a, const void *k, HeliCompareCallback cmp);
8eb855
HeliPair* heliMapAdd(
8eb855
	HeliArray *a, const void *k, HeliCompareCallback cmp,
8eb855
	HeliCloneCallback ck, HeliFreeCallback fk,
8eb855
	void *v, HeliFreeCallback fv );
8eb855
int heliMapRemove(HeliArray *a, const void *k, HeliCompareCallback cmp);
8eb855
8535a3
HeliPair* heliStringmapFind(HeliArray *a, const char *k, int *gtOrEqIndex);
8535a3
HeliPair* heliStringmapGet(HeliArray *a, const char *k);
8535a3
HeliPair* heliStringmapAdd(HeliArray *a, const char *k, void *v, HeliFreeCallback fv);
8535a3
int heliStringmapRemove(HeliArray *a, const char *k);
3f9996
8535a3
8eb855
// all objects
8eb855
8eb855
extern int heliInitialized;
8eb855
extern HeliArray heliObjectsSet;
8eb855
void heliObjectRegister(void *o, HeliFreeCallback fo);
8eb855
void heliObjectUnregister(void *o);
8eb855
8eb855
8535a3
// animation
8535a3
1c7488
typedef struct _HeliAnimation {
8535a3
	char *path;
8535a3
	HeliArray frames;
8535a3
	int refcount;
1c7488
} HeliAnimation;
8535a3
1c7488
HeliAnimation* heliAnimationLoad(const char *path);
1c7488
void heliAnimationUnref(HeliAnimation *a);
07b70f
void heliAnimationFinish();
3f9996
3f9996
3f9996
// collider
3f9996
3f9996
typedef struct _HeliCollider {
3f9996
	Collider type;
3f9996
	double x;
3f9996
	double y;
3f9996
	double radius;
3f9996
	double width;
3f9996
	double height;
3f9996
	double rotation;
3f9996
} HeliCollider;
3f9996
1c7488
int heliCheckCollision(
1c7488
	HeliCollider *a, HeliCollider *b,
1c7488
	double *dx, double *dy,
1c7488
	double *vx, double *vy,
1c7488
	double bounciness );
1c7488
3f9996
int heliPointCollision(HeliCollider *c, double x, double y);
3f9996
8535a3
8535a3
// sprite
8535a3
07b70f
typedef void (*HeliSpriteEashInt)(Sprite, int);
07b70f
typedef void (*HeliSpriteEashDouble)(Sprite, double);
07b70f
typedef void (*HeliSpriteEashString)(Sprite, const char*);
8535a3
HeliArray* heliSpriteGetGroups(Sprite sprite);
07b70f
void heliSpriteUpdate(double dt);
07b70f
void heliSpriteFinish();
8535a3
07b70f
07b70f
// drawing
07b70f
3954ba
typedef struct _HeliDrawingState {
3954ba
	double colorStroke[4];
3954ba
	double colorFill[4];
3954ba
	double lineWidth;
3954ba
	HAlign horAlign;
3954ba
	VAlign vertAlign;
3954ba
	Font font;
3954ba
	double fontSize;
3954ba
} HeliDrawingState;
3954ba
3954ba
HeliDrawingState *heliDrawingGetState();
3954ba
HeliDrawingState *heliDrawingGetStateStack();
f63775
void heliDrawingClearFrame();
07b70f
void heliDrawingPrepareFrame();
07b70f
void heliDrawingFinish();
d1f083
d1f083
a20939
// font
a20939
a20939
void heliFontFinish();
a20939
a20939
09c823
// sound
09c823
09c823
void heliSoundUpdate();
09c823
void heliSoundFinish();
09c823
09c823
d1f083
// test
d1f083
d1f083
void heliDoTests();
d1f083