KroysCoreApi
Logging, errors, per-user settings, paths and component types. Available in every host (editor and player).
Declaration
Declared in kroys/kroys_plugin.h.
kroys_plugin.h
typedef struct KroysCoreApi { ... } KroysCoreApi;
Members
#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.
#uint32_t reserved;Padding reserved for later use; leave it 0.
#void (KROYS_CALL* Log)(KroysContext context, int32_t severity, const char* message);Thread-safe.
#const char* (KROYS_CALL* LastError)(KroysContext context);Thread-safe. The calling thread's last error message ("" when none).
#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.
#const char* (KROYS_CALL* PluginId)(KroysContext context);The plugin's manifest id (host string).
#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).
#const char* (KROYS_CALL* GetSetting)(KroysContext context, const char* key, const char* fallback);Per-user plugin settings (saved under the user settings folder).
#KroysResult (KROYS_CALL* SetSetting)(KroysContext context, const char* key, const char* value);Stores a per-user plugin setting (kept across reloads and restarts).
#KroysResult (KROYS_CALL* Unregister)(KroysContext context, KroysHandle handle);Removes one registration (command, panel, system, ...).
#KroysResult (KROYS_CALL* RegisterComponentType)(KroysContext context, const KroysComponentTypeDesc* desc, KroysComponentType* outType);Capability "components". Registering an identical definition again returns the same type.
#int32_t (KROYS_CALL* IsMainThread)(KroysContext context);Thread-safe.
#double (KROYS_CALL* TimeSeconds)(KroysContext context);Thread-safe. Monotonic seconds.
#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.
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.