lovr/src/util.h

31 lines
735 B
C
Raw Normal View History

2017-03-11 10:19:33 +00:00
#include "lib/vec/vec.h"
2018-02-23 05:01:34 +00:00
#include "lib/tinycthread/tinycthread.h"
2017-08-02 08:25:56 +00:00
#include <stdint.h>
2017-01-22 02:00:32 +00:00
#include <stddef.h>
#include <setjmp.h>
2016-09-30 06:18:51 +00:00
2017-01-26 10:20:30 +00:00
#pragma once
2016-10-04 22:05:34 +00:00
#define lovrAssert(c, ...) if (!(c)) { lovrThrow(__VA_ARGS__); }
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;
2017-08-02 08:25:56 +00:00
typedef struct {
float r, g, b, a;
2017-08-02 08:25:56 +00:00
} Color;
2018-02-26 05:34:10 +00:00
extern _Thread_local char lovrErrorMessage[];
extern _Thread_local jmp_buf* lovrCatch;
void lovrThrow(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);
2017-02-06 09:54:11 +00:00
size_t utf8_decode(const char *s, const char *e, unsigned *pch);