mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[c] Direct setListener on track entry and animation state
This commit is contained in:
parent
ef0c74a8d6
commit
ff8f5f7b6b
@ -1,15 +0,0 @@
|
|||||||
FROM ubuntu:24.04
|
|
||||||
|
|
||||||
# Install build dependencies for spine-c
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
build-essential \
|
|
||||||
cmake \
|
|
||||||
ninja-build \
|
|
||||||
git \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Set working directory
|
|
||||||
WORKDIR /workspace
|
|
||||||
|
|
||||||
# Default command
|
|
||||||
CMD ["bash"]
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Get to the script's directory
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
|
|
||||||
# Build Docker image if it doesn't exist or if Dockerfile changed
|
|
||||||
IMAGE_NAME="spine-c-build"
|
|
||||||
if ! docker images | grep -q "$IMAGE_NAME" || [ Dockerfile -nt .docker-built ]; then
|
|
||||||
echo "Building Docker image for spine-c..."
|
|
||||||
docker build -t "$IMAGE_NAME" .
|
|
||||||
touch .docker-built
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clean build directory to avoid platform conflicts
|
|
||||||
if [ -d "build" ]; then
|
|
||||||
echo "Cleaning build directory to avoid platform conflicts..."
|
|
||||||
rm -rf build
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run the build in Docker
|
|
||||||
echo "Building spine-c in Docker container..."
|
|
||||||
docker run --rm \
|
|
||||||
-v "$(cd .. && pwd)":/workspace \
|
|
||||||
-w /workspace/spine-c \
|
|
||||||
"$IMAGE_NAME" \
|
|
||||||
./build.sh "$@"
|
|
||||||
@ -574,3 +574,28 @@ void spine_bone_pose_parent_to_world_v(spine_bone_pose self, float parent_x, flo
|
|||||||
spine_array_float_add(output, worldX);
|
spine_array_float_add(output, worldX);
|
||||||
spine_array_float_add(output, worldY);
|
spine_array_float_add(output, worldY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Event listener functions
|
||||||
|
void spine_animation_state_set_listener(spine_animation_state state, spine_animation_state_listener listener, void *user_data) {
|
||||||
|
if (!state) return;
|
||||||
|
AnimationState *_state = (AnimationState *) state;
|
||||||
|
_state->setListener((AnimationStateListener) listener, user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void spine_animation_state_clear_listener(spine_animation_state state) {
|
||||||
|
if (!state) return;
|
||||||
|
AnimationState *_state = (AnimationState *) state;
|
||||||
|
_state->setListener((AnimationStateListener) nullptr, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void spine_track_entry_set_listener(spine_track_entry entry, spine_animation_state_listener listener, void *user_data) {
|
||||||
|
if (!entry) return;
|
||||||
|
TrackEntry *_entry = (TrackEntry *) entry;
|
||||||
|
_entry->setListener((AnimationStateListener) listener, user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void spine_track_entry_clear_listener(spine_track_entry entry) {
|
||||||
|
if (!entry) return;
|
||||||
|
TrackEntry *_entry = (TrackEntry *) entry;
|
||||||
|
_entry->setListener((AnimationStateListener) nullptr, nullptr);
|
||||||
|
}
|
||||||
@ -118,6 +118,18 @@ SPINE_C_API void spine_bone_pose_local_to_world_v(spine_bone_pose self, float lo
|
|||||||
SPINE_C_API void spine_bone_pose_world_to_parent_v(spine_bone_pose self, float world_x, float world_y, spine_array_float output);
|
SPINE_C_API void spine_bone_pose_world_to_parent_v(spine_bone_pose self, float world_x, float world_y, spine_array_float output);
|
||||||
SPINE_C_API void spine_bone_pose_parent_to_world_v(spine_bone_pose self, float parent_x, float parent_y, spine_array_float output);
|
SPINE_C_API void spine_bone_pose_parent_to_world_v(spine_bone_pose self, float parent_x, float parent_y, spine_array_float output);
|
||||||
|
|
||||||
|
// Event listener functions
|
||||||
|
typedef void (*spine_animation_state_listener)(spine_animation_state state, spine_event_type type, spine_track_entry entry, spine_event event,
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
|
SPINE_C_API void spine_animation_state_set_listener(spine_animation_state state, spine_animation_state_listener listener, void *user_data);
|
||||||
|
|
||||||
|
SPINE_C_API void spine_animation_state_clear_listener(spine_animation_state state);
|
||||||
|
|
||||||
|
SPINE_C_API void spine_track_entry_set_listener(spine_track_entry entry, spine_animation_state_listener listener, void *user_data);
|
||||||
|
|
||||||
|
SPINE_C_API void spine_track_entry_clear_listener(spine_track_entry entry);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user