2016-11-19 09:28:01 +00:00
|
|
|
#include "vendor/vec/vec.h"
|
2017-01-22 02:00:32 +00:00
|
|
|
#include <stddef.h>
|
2016-09-30 06:18:51 +00:00
|
|
|
|
2017-01-22 02:00:32 +00:00
|
|
|
#ifndef LOVR_UTIL
|
|
|
|
#define LOVR_UTIL
|
2016-10-04 22:05:34 +00:00
|
|
|
|
2017-01-22 02:00:32 +00:00
|
|
|
#define containerof(ptr, type) ((type*)((char*)(ptr) - offsetof(type, ref)))
|
2016-11-14 23:48:17 +00:00
|
|
|
#define LOVR_COLOR(r, g, b, a) ((a << 0) | (b << 8) | (g << 16) | (r << 24))
|
|
|
|
#define LOVR_COLOR_R(c) (c >> 24 & 0xff)
|
|
|
|
#define LOVR_COLOR_G(c) (c >> 16 & 0xff)
|
|
|
|
#define LOVR_COLOR_B(c) (c >> 8 & 0xff)
|
|
|
|
#define LOVR_COLOR_A(c) (c >> 0 & 0xff)
|
|
|
|
|
2017-01-22 02:00:32 +00:00
|
|
|
typedef vec_t(unsigned int) vec_uint_t;
|
2016-11-19 07:41:23 +00:00
|
|
|
|
|
|
|
typedef struct ref {
|
|
|
|
void (*free)(const struct ref* ref);
|
|
|
|
int count;
|
|
|
|
} Ref;
|
|
|
|
|
2016-07-07 07:04:24 +00:00
|
|
|
void error(const char* format, ...);
|
2016-11-26 07:32:48 +00:00
|
|
|
void lovrSleep(double seconds);
|
2016-11-19 07:41:23 +00:00
|
|
|
void* lovrAlloc(size_t size, void (*destructor)(const Ref* ref));
|
|
|
|
void lovrRetain(const Ref* ref);
|
|
|
|
void lovrRelease(const Ref* ref);
|
2016-11-19 08:37:43 +00:00
|
|
|
|
2017-01-22 02:00:32 +00:00
|
|
|
#endif
|