|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
The DragonBones side module's exported ABI. More...
#include <algorithm>#include <cstring>#include <string>#include <vector>#include "./DragonBonesAdapter.hpp"#include "./DragonBonesBindings.hpp"#include "../spine/SkeletalModule.hpp"
Go to the source code of this file.
Macros | |
| #define | EMSCRIPTEN_KEEPALIVE |
Functions | |
| int | db_loadSkeleton (uintptr_t skeletonPtr, int skeletonLen, uintptr_t atlasPtr, int atlasLen) |
| const char * | db_getLastError () |
| void | db_unloadSkeleton (int handle) |
| const char * | db_getArmatures (int handle) |
| ["armatureA","armatureB"] — a DragonBones file names more than one. | |
| const char * | db_getAtlasImageName (int handle) |
| The image this file's atlas expects, so the caller knows what to upload. | |
| void | db_setAtlasTexture (int handle, uint32_t textureId) |
| int | db_createInstance (int skeletonHandle, const char *armatureName) |
| void | db_destroyInstance (int instanceId) |
| int | db_playAnimation (int instanceId, const char *name, int playTimes) |
| playTimes: -1 keeps what the data says, 0 loops, n plays n times. | |
| int | db_fadeInAnimation (int instanceId, const char *name, float fadeSeconds, int playTimes) |
| Where Spine would set a mix duration: DragonBones fades at the moment of play. | |
| void | db_stopAnimation (int instanceId, const char *name) |
| void | db_setTimeScale (int instanceId, float scale) |
| void | db_setColor (int instanceId, float r, float g, float b, float a) |
| void | db_update (int instanceId, float dt) |
| const char * | db_getAnimations (int instanceId) |
| const char * | db_getBones (int instanceId) |
| int | db_getBonePoses (int instanceId, uintptr_t outPtr, int capacity) |
| int | db_getMeshBatchCount (int instanceId) |
| int | db_getMeshBatchVertexCount (int instanceId, int batchIndex) |
| int | db_getMeshBatchIndexCount (int instanceId, int batchIndex) |
| void | db_getMeshBatchData (int instanceId, int batchIndex, uintptr_t outVerticesPtr, uintptr_t outIndicesPtr, uintptr_t outTextureIdPtr, uintptr_t outBlendModePtr) |
| void | db_getBounds (int instanceId, uintptr_t outXPtr, uintptr_t outYPtr, uintptr_t outWPtr, uintptr_t outHPtr) |
| int | db_runtimeVersion () |
| 5 — the DragonBones data format this runtime reads, for the SDK's version gate. | |
The DragonBones side module's exported ABI.
Handles, batching, the returned-string storage and the event queue all come from SkeletalModule.hpp, which the Spine module uses for the same things. What is written here is only what DragonBones does differently, and there are three such places worth naming.
ONE FILE HOLDS SEVERAL ARMATURES. Spine's skeleton is the file; a DragonBones file is a project and names its armatures (mecha_2903 ships four). So creating an instance takes an armature name, and db_getArmatures exists at all.
BLENDING IS PER PLAY, NOT A TABLE. Spine mixes through a from/to matrix set on the skeleton; DragonBones fades in when you start an animation. Neither is expressible as the other, so the ABI says fadeIn and does not pretend to have a mix table.
THE ATLAS IS ONE PAGE. Spine's atlas names its pages and the caller binds each; a DragonBones atlas is one image, so the page API here is the degenerate case rather than a second shape for the SDK to learn.
Definition in file DragonBonesModuleEntry.cpp.
| #define EMSCRIPTEN_KEEPALIVE |
Definition at line 37 of file DragonBonesModuleEntry.cpp.
Referenced by physics_collisionEnterBytes(), physics_collisionExitBytes(), physics_dynamicBodyTransformsBytes(), physics_hitEventBytes(), physics_interpolatedTransformsBytes(), physics_moveCharacterBytes(), physics_overlapBytes(), physics_raycastBytes(), physics_sensorEnterBytes(), physics_sensorExitBytes(), and physics_shapeCastBytes().
| int db_createInstance | ( | int | skeletonHandle, |
| const char * | armatureName ) |
Definition at line 215 of file DragonBonesModuleEntry.cpp.
References EsFactory::buildArmature(), g_ctx, and EsFactory::instance().
| void db_destroyInstance | ( | int | instanceId | ) |
Definition at line 230 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| int db_fadeInAnimation | ( | int | instanceId, |
| const char * | name, | ||
| float | fadeSeconds, | ||
| int | playTimes ) |
Where Spine would set a mix duration: DragonBones fades at the moment of play.
Where Spine would set a mix duration: DragonBones fades at the moment of play.
Definition at line 251 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| const char * db_getAnimations | ( | int | instanceId | ) |
Definition at line 295 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| const char * db_getArmatures | ( | int | handle | ) |
["armatureA","armatureB"] — a DragonBones file names more than one.
["armatureA","armatureB"] — a DragonBones file names more than one.
Definition at line 179 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| const char * db_getAtlasImageName | ( | int | handle | ) |
The image this file's atlas expects, so the caller knows what to upload.
Definition at line 189 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| int db_getBonePoses | ( | int | instanceId, |
| uintptr_t | outPtr, | ||
| int | capacity ) |
Every bone's parent index and pose in one call: 5 floats a bone — parent (-1 for a root), x, y, degrees, length — into outPtr, at most capacity bones; returns how many it wrote. Posed in the y-UP space the geometry leaves the runtime in (see EsArmatureProxy), so the skeleton drawn over the artwork lands on it.
Definition at line 320 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| const char * db_getBones | ( | int | instanceId | ) |
The bone names, in the armature's own order — a parent before each of its children.
Definition at line 305 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| void db_getBounds | ( | int | instanceId, |
| uintptr_t | outXPtr, | ||
| uintptr_t | outYPtr, | ||
| uintptr_t | outWPtr, | ||
| uintptr_t | outHPtr ) |
@heapreturn outXPtr, outYPtr, outWPtr, outHPtr
Definition at line 390 of file DragonBonesModuleEntry.cpp.
References g_ctx, and es::skeletal::VERTEX_FLOATS.
| const char * db_getLastError | ( | ) |
Definition at line 157 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| int db_getMeshBatchCount | ( | int | instanceId | ) |
Definition at line 355 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| void db_getMeshBatchData | ( | int | instanceId, |
| int | batchIndex, | ||
| uintptr_t | outVerticesPtr, | ||
| uintptr_t | outIndicesPtr, | ||
| uintptr_t | outTextureIdPtr, | ||
| uintptr_t | outBlendModePtr ) |
@heapreturn outVerticesPtr, outIndicesPtr, outTextureIdPtr, outBlendModePtr
Definition at line 375 of file DragonBonesModuleEntry.cpp.
References es::skeletal::MeshBatch::blendMode, es::skeletal::Buffer< T >::data(), g_ctx, es::skeletal::MeshBatch::indices, es::skeletal::Buffer< T >::size(), es::skeletal::MeshBatch::texture, and es::skeletal::MeshBatch::vertices.
| int db_getMeshBatchIndexCount | ( | int | instanceId, |
| int | batchIndex ) |
Definition at line 368 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| int db_getMeshBatchVertexCount | ( | int | instanceId, |
| int | batchIndex ) |
Definition at line 361 of file DragonBonesModuleEntry.cpp.
References g_ctx, and es::skeletal::VERTEX_FLOATS.
| int db_loadSkeleton | ( | uintptr_t | skeletonPtr, |
| int | skeletonLen, | ||
| uintptr_t | atlasPtr, | ||
| int | atlasLen ) |
Definition at line 120 of file DragonBonesModuleEntry.cpp.
References g_ctx, and EsFactory::instance().
| int db_playAnimation | ( | int | instanceId, |
| const char * | name, | ||
| int | playTimes ) |
playTimes: -1 keeps what the data says, 0 loops, n plays n times.
playTimes: -1 keeps what the data says, 0 loops, n plays n times.
Definition at line 243 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| int db_runtimeVersion | ( | ) |
5 — the DragonBones data format this runtime reads, for the SDK's version gate.
The DragonBones data format this runtime reads, for the SDK's version gate.
Definition at line 420 of file DragonBonesModuleEntry.cpp.
| void db_setAtlasTexture | ( | int | handle, |
| uint32_t | textureId ) |
Definition at line 195 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| void db_setColor | ( | int | instanceId, |
| float | r, | ||
| float | g, | ||
| float | b, | ||
| float | a ) |
Tint this instance. Multiplied onto each slot's authored colour, so opaque white leaves the armature exactly as it was drawn.
Definition at line 272 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| void db_setTimeScale | ( | int | instanceId, |
| float | scale ) |
Definition at line 264 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| void db_stopAnimation | ( | int | instanceId, |
| const char * | name ) |
Definition at line 258 of file DragonBonesModuleEntry.cpp.
References g_ctx.
| void db_unloadSkeleton | ( | int | handle | ) |
Definition at line 160 of file DragonBonesModuleEntry.cpp.
References g_ctx, and EsFactory::instance().
| void db_update | ( | int | instanceId, |
| float | dt ) |
Definition at line 282 of file DragonBonesModuleEntry.cpp.
References EsFactory::advanceTime(), g_ctx, and EsFactory::instance().