Inital context stuff and tests

Linking and  building is successfull and inital tests pass
This commit is contained in:
chrisbell committed 2026-11-02 14:16:16 -06:00
1 parent 2296f68123
commit 363e9894e8
10 files changed
+410 -59

No files matched your search

+28 -31
View File
@@ -6,24 +6,22 @@
Last edit date: 11-02-2026
*/
#ifndef REGOLITH_H
#define REGOLITH_H
#include <cstddef>
#include <cstdint>
#include <stddef.h>
#include <stdint.h>
#if defined(_WIN32) && defined(RG_SHARED)
#ifdef RG_BUILD
#define RG_API __declspec(dllexport)
#else
#define RG_API __declspec(dllimport)
#endif
#elif defined(__GNUC__)
#define RG_API __attribute__((visibility("default")))
#ifdef RG_BUILD
#define RG_API __declspec(dllexport)
#else
#define RG_API
#define RG_API __declspec(dllimport)
#endif
#elif defined(__GNUC__)
#define RG_API __attribute__((visibility("default")))
#else
#define RG_API
#endif
#ifdef __cplusplus
@@ -32,26 +30,27 @@ extern "C" {
#define RG_VERSION_STRING "0.0.1"
/*
TODO: Add documentation comments
*/
enum {
RG_LOG_TRACE = 0,
RG_LOG_DEBUG,
RG_LOG_INFO,
RG_LOG_WARN,
RG_LOG_ERROR
RG_OK = 0,
RG_ERR_GENERIC = -1,
RG_ERR_NO_MEMORY = -2,
RG_ERR_STATE = -3,
RG_ERR_LUA = -4
};
enum { RG_LOG_TRACE = 0, RG_LOG_DEBUG, RG_LOG_INFO, RG_LOG_WARN, RG_LOG_ERROR };
typedef struct rg_context rg_context;
typedef struct rg_allocator {
void* (*alloc)(size_t size, void* user);
void* (*realloc)(void* ptr, size_t old_size, size_t new_size, void* user);
void* (*free)(void* ptr, size_t size, void* user);
void* user;
void *(*alloc)(size_t size, void *user);
void *(*realloc)(void *ptr, size_t old_size, size_t new_size, void *user);
void (*free)(void *ptr, size_t size, void *user);
void *user;
} rg_allocator;
typedef void (*rg_log_fn)(int32_t level, const char *message, void *user);
@@ -60,20 +59,18 @@ typedef struct rg_config {
uint32_t struct_size;
rg_allocator allocator;
rg_log_fn log;
void* log_user;
void *log_user;
int32_t log_level;
int32_t viewport_w;
int32_t viewport_h;
float display_scale;
} rg_config;
RG_API const char* rg_version(void);
RG_API void rg_config_init(rg_config* config);
RG_API rg_context* rg_create(const rg_config* config);
RG_API void rg_destroy(rg_context* ctx);
RG_API const char* rg_last_error(const rg_context* ctx);
RG_API const char *rg_version(void);
RG_API void rg_config_init(rg_config *config);
RG_API rg_context *rg_create(const rg_config *config);
RG_API void rg_destroy(rg_context *ctx);
RG_API const char *rg_last_error(const rg_context *ctx);
#ifdef __cplusplus
}