83 lines
1.5 KiB
C++
83 lines
1.5 KiB
C++
/*
|
|
regolith.h
|
|
Regolith public API
|
|
Author: Chris Bell
|
|
Last edited by: Chris Bell
|
|
Last edit date: 11-02-2026
|
|
*/
|
|
|
|
|
|
|
|
#ifndef REGOLITH_H
|
|
#define REGOLITH_H
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
#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")))
|
|
#else
|
|
#define RG_API
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#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
|
|
};
|
|
|
|
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;
|
|
} rg_allocator;
|
|
|
|
typedef void (*rg_log_fn)(int32_t level, const char *message, void *user);
|
|
|
|
typedef struct rg_config {
|
|
uint32_t struct_size;
|
|
rg_allocator allocator;
|
|
rg_log_fn log;
|
|
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);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|