91 lines
2.6 KiB
C
91 lines
2.6 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#if defined(_WIN32)
|
|
#define DTS_RUNTIME_EXPORT __declspec(dllexport)
|
|
#else
|
|
#define DTS_RUNTIME_EXPORT __attribute__((visibility("default")))
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
enum { DTS_RUNTIME_API_VERSION = 3 };
|
|
|
|
enum DtsRuntimeCapability {
|
|
DTS_RUNTIME_CAP_SKELETON_METADATA = 1u << 0,
|
|
DTS_RUNTIME_CAP_DRAW_COMMANDS = 1u << 1
|
|
};
|
|
|
|
typedef struct DtsRuntimeInfo {
|
|
uint32_t structSize;
|
|
uint32_t apiVersion;
|
|
const char* spineVersionLine;
|
|
const char* adapterBuild;
|
|
uint32_t capabilities;
|
|
} DtsRuntimeInfo;
|
|
|
|
typedef void* DtsRuntimeHandle;
|
|
|
|
typedef struct DtsLoadRequest {
|
|
uint32_t structSize;
|
|
const char* skeletonPathUtf8;
|
|
const char* atlasPathUtf8;
|
|
float scale;
|
|
} DtsLoadRequest;
|
|
|
|
typedef struct DtsSkeletonInfo {
|
|
uint32_t structSize;
|
|
uint32_t boneCount;
|
|
uint32_t slotCount;
|
|
uint32_t skinCount;
|
|
uint32_t animationCount;
|
|
uint32_t eventCount;
|
|
uint32_t constraintCount;
|
|
} DtsSkeletonInfo;
|
|
|
|
typedef struct DtsRenderVertex {
|
|
float x;
|
|
float y;
|
|
float u;
|
|
float v;
|
|
uint32_t color;
|
|
} DtsRenderVertex;
|
|
|
|
typedef struct DtsDrawCommand {
|
|
uint32_t structSize;
|
|
const DtsRenderVertex* vertices;
|
|
uint32_t vertexCount;
|
|
const uint16_t* indices;
|
|
uint32_t indexCount;
|
|
const char* texturePathUtf8;
|
|
uint32_t blendMode;
|
|
} DtsDrawCommand;
|
|
|
|
DTS_RUNTIME_EXPORT uint32_t dtsRuntimeGetApiVersion(void);
|
|
DTS_RUNTIME_EXPORT int32_t dtsRuntimeGetInfo(DtsRuntimeInfo* info);
|
|
DTS_RUNTIME_EXPORT DtsRuntimeHandle dtsRuntimeCreate(void);
|
|
DTS_RUNTIME_EXPORT void dtsRuntimeDestroy(DtsRuntimeHandle handle);
|
|
DTS_RUNTIME_EXPORT int32_t dtsRuntimeLoad(DtsRuntimeHandle handle, const DtsLoadRequest* request);
|
|
DTS_RUNTIME_EXPORT int32_t dtsRuntimeGetSkeletonInfo(
|
|
DtsRuntimeHandle handle, DtsSkeletonInfo* info);
|
|
DTS_RUNTIME_EXPORT const char* dtsRuntimeGetAnimationName(
|
|
DtsRuntimeHandle handle, uint32_t index);
|
|
DTS_RUNTIME_EXPORT float dtsRuntimeGetAnimationDuration(
|
|
DtsRuntimeHandle handle, uint32_t index);
|
|
DTS_RUNTIME_EXPORT const char* dtsRuntimeGetSkinName(
|
|
DtsRuntimeHandle handle, uint32_t index);
|
|
DTS_RUNTIME_EXPORT const char* dtsRuntimeGetLastError(DtsRuntimeHandle handle);
|
|
DTS_RUNTIME_EXPORT int32_t dtsRuntimeSetAnimation(
|
|
DtsRuntimeHandle handle, const char* animationNameUtf8, int32_t loop);
|
|
DTS_RUNTIME_EXPORT int32_t dtsRuntimeUpdate(DtsRuntimeHandle handle, float deltaSeconds);
|
|
DTS_RUNTIME_EXPORT uint32_t dtsRuntimeGetDrawCommandCount(DtsRuntimeHandle handle);
|
|
DTS_RUNTIME_EXPORT int32_t dtsRuntimeGetDrawCommand(
|
|
DtsRuntimeHandle handle, uint32_t index, DtsDrawCommand* command);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|