KROYSDOCS
HomeWhat's newv0.1.0
C/C++ SDK / C ABI · Core (all targets) / KroysCoreApi

KroysCoreApi

Logging, errors, per-user settings, paths and component types. Available in every host (editor and player).

Kindstruct
Headerkroys/kroys_plugin.h
Members14
Functions12
DECLARATION

Declaration

Declared in kroys/kroys_plugin.h.

kroys_plugin.h
typedef struct KroysCoreApi { ... } KroysCoreApi;
REFERENCE

Members

Fields
#uint32_t structSize;

Size of this struct as the writer compiled it (sizeof); the reader uses it to detect members appended by later minor versions.

field
#uint32_t reserved;

Padding reserved for later use; leave it 0.

field
Functions
#void (KROYS_CALL* Log)(KroysContext context, int32_t severity, const char* message);

Thread-safe.

function pointer
#const char* (KROYS_CALL* LastError)(KroysContext context);

Thread-safe. The calling thread's last error message ("" when none).

function pointer
#void (KROYS_CALL* ReportFailure)(KroysContext context, const char* message);

The plugin hit an unrecoverable error (the C++ wrapper calls it for escaped exceptions): the host disables the plugin for the session.

function pointer
#const char* (KROYS_CALL* PluginId)(KroysContext context);

The plugin's manifest id (host string).

function pointer
#const char* (KROYS_CALL* GetPath)(KroysContext context, int32_t which);

A folder of the plugin's environment: KROYS_PATH_PLUGIN, KROYS_PATH_PROJECT, KROYS_PATH_CONTENT or KROYS_PATH_PLUGIN_DATA (host string).

function pointer
#const char* (KROYS_CALL* GetSetting)(KroysContext context, const char* key, const char* fallback);

Per-user plugin settings (saved under the user settings folder).

function pointer
#KroysResult (KROYS_CALL* SetSetting)(KroysContext context, const char* key, const char* value);

Stores a per-user plugin setting (kept across reloads and restarts).

function pointer
#KroysResult (KROYS_CALL* Unregister)(KroysContext context, KroysHandle handle);

Removes one registration (command, panel, system, ...).

function pointer
#KroysResult (KROYS_CALL* RegisterComponentType)(KroysContext context, const KroysComponentTypeDesc* desc, KroysComponentType* outType);

Capability "components". Registering an identical definition again returns the same type.

function pointer
#int32_t (KROYS_CALL* IsMainThread)(KroysContext context);

Thread-safe.

function pointer
#double (KROYS_CALL* TimeSeconds)(KroysContext context);

Thread-safe. Monotonic seconds.

function pointer
#uint64_t (KROYS_CALL* ReadLog)(KroysContext context, uint64_t afterSequence, uint32_t maxEntries, const KroysLogVisitor* visitor);

Thread-safe. Visits the console entries the host still keeps that are newer than afterSequence (0: all kept), oldest first, at most maxEntries (0: no limit). Returns the sequence of the last entry visited, or afterSequence when none was.

function pointersince 2.2
Members
uint32_t structSize;
uint32_t reserved;
void (KROYS_CALL* Log)(KroysContext context, int32_t severity, const char* message);
const char* (KROYS_CALL* LastError)(KroysContext context);
void (KROYS_CALL* ReportFailure)(KroysContext context, const char* message);
const char* (KROYS_CALL* PluginId)(KroysContext context);
const char* (KROYS_CALL* GetPath)(KroysContext context, int32_t which);
const char* (KROYS_CALL* GetSetting)(KroysContext context, const char* key, const char* fallback);
KroysResult (KROYS_CALL* SetSetting)(KroysContext context, const char* key, const char* value);
KroysResult (KROYS_CALL* Unregister)(KroysContext context, KroysHandle handle);
KroysResult (KROYS_CALL* RegisterComponentType)(KroysContext context, const KroysComponentTypeDesc* desc, KroysComponentType* outType);
int32_t (KROYS_CALL* IsMainThread)(KroysContext context);
double (KROYS_CALL* TimeSeconds)(KroysContext context);
uint64_t (KROYS_CALL* ReadLog)(KroysContext context, uint64_t afterSequence, uint32_t maxEntries, const KroysLogVisitor* visitor);

KroysEngine 0.1.0 documentation, built from the engine repository by Tools/BuildDocsSite.py.