mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-09 08:38:43 +08:00
Added IK keys to raptor example.
This commit is contained in:
parent
d1965f1b5d
commit
9749db7a0a
@ -49,6 +49,8 @@ bool RaptorExample::init () {
|
||||
|
||||
skeletonNode = SkeletonAnimation::createWithFile("raptor.json", "raptor.atlas", 0.5f);
|
||||
skeletonNode->setAnimation(0, "walk", true);
|
||||
skeletonNode->setAnimation(1, "empty", false);
|
||||
skeletonNode->addAnimation(1, "gungrab", false, 2);
|
||||
|
||||
Size windowSize = Director::getInstance()->getWinSize();
|
||||
skeletonNode->setPosition(Vec2(windowSize.width / 2, 20));
|
||||
|
||||
@ -4,245 +4,245 @@ size: 1022,1022
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
images/back_arm
|
||||
back_arm
|
||||
rotate: false
|
||||
xy: 410, 545
|
||||
size: 46, 29
|
||||
orig: 46, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/back_bracer
|
||||
back_bracer
|
||||
rotate: false
|
||||
xy: 540, 548
|
||||
size: 39, 28
|
||||
orig: 39, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/back_hand
|
||||
back_hand
|
||||
rotate: true
|
||||
xy: 504, 538
|
||||
size: 36, 34
|
||||
orig: 36, 34
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/back_knee
|
||||
back_knee
|
||||
rotate: false
|
||||
xy: 299, 478
|
||||
size: 49, 67
|
||||
orig: 49, 67
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/back_thigh
|
||||
back_thigh
|
||||
rotate: true
|
||||
xy: 140, 247
|
||||
size: 39, 24
|
||||
orig: 39, 24
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/eyes_open
|
||||
eyes_open
|
||||
rotate: true
|
||||
xy: 2, 2
|
||||
size: 47, 45
|
||||
orig: 47, 45
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/front_arm
|
||||
front_arm
|
||||
rotate: false
|
||||
xy: 360, 544
|
||||
size: 48, 30
|
||||
orig: 48, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/front_bracer
|
||||
front_bracer
|
||||
rotate: false
|
||||
xy: 538, 578
|
||||
size: 41, 29
|
||||
orig: 41, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/front_hand
|
||||
front_hand
|
||||
rotate: false
|
||||
xy: 538, 609
|
||||
size: 41, 38
|
||||
orig: 41, 38
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/front_open_hand
|
||||
front_open_hand
|
||||
rotate: false
|
||||
xy: 894, 782
|
||||
size: 43, 44
|
||||
orig: 43, 44
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/front_thigh
|
||||
front_thigh
|
||||
rotate: false
|
||||
xy: 942, 849
|
||||
size: 57, 29
|
||||
orig: 57, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/gun
|
||||
gun
|
||||
rotate: false
|
||||
xy: 785, 774
|
||||
size: 107, 103
|
||||
orig: 107, 103
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/gun_nohand
|
||||
gun_nohand
|
||||
rotate: false
|
||||
xy: 614, 703
|
||||
size: 105, 102
|
||||
orig: 105, 102
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/head
|
||||
head
|
||||
rotate: false
|
||||
xy: 2, 137
|
||||
size: 136, 149
|
||||
orig: 136, 149
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/lower_leg
|
||||
lower_leg
|
||||
rotate: true
|
||||
xy: 780, 699
|
||||
size: 73, 98
|
||||
orig: 73, 98
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/mouth_smile
|
||||
mouth_smile
|
||||
rotate: true
|
||||
xy: 49, 2
|
||||
size: 47, 30
|
||||
orig: 47, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/neck
|
||||
neck
|
||||
rotate: true
|
||||
xy: 1001, 860
|
||||
size: 18, 21
|
||||
orig: 18, 21
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_arm_back
|
||||
raptor_arm_back
|
||||
rotate: false
|
||||
xy: 940, 936
|
||||
size: 82, 86
|
||||
orig: 82, 86
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_body
|
||||
raptor_body
|
||||
rotate: false
|
||||
xy: 2, 737
|
||||
size: 610, 285
|
||||
orig: 610, 285
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_front_arm
|
||||
raptor_front_arm
|
||||
rotate: true
|
||||
xy: 195, 464
|
||||
size: 81, 102
|
||||
orig: 81, 102
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_front_leg
|
||||
raptor_front_leg
|
||||
rotate: false
|
||||
xy: 2, 478
|
||||
size: 191, 257
|
||||
orig: 191, 257
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_hindleg_back
|
||||
raptor_hindleg_back
|
||||
rotate: false
|
||||
xy: 614, 807
|
||||
size: 169, 215
|
||||
orig: 169, 215
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_horn
|
||||
raptor_horn
|
||||
rotate: false
|
||||
xy: 360, 655
|
||||
size: 182, 80
|
||||
orig: 182, 80
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_horn_back
|
||||
raptor_horn_back
|
||||
rotate: false
|
||||
xy: 360, 576
|
||||
size: 176, 77
|
||||
orig: 176, 77
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_jaw
|
||||
raptor_jaw
|
||||
rotate: false
|
||||
xy: 785, 879
|
||||
size: 153, 143
|
||||
orig: 153, 143
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_saddle_noshadow
|
||||
raptor_saddle_noshadow
|
||||
rotate: false
|
||||
xy: 2, 288
|
||||
size: 163, 188
|
||||
orig: 163, 188
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_saddle_strap_front
|
||||
raptor_saddle_strap_front
|
||||
rotate: false
|
||||
xy: 721, 710
|
||||
size: 57, 95
|
||||
orig: 57, 95
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_saddle_strap_rear
|
||||
raptor_saddle_strap_rear
|
||||
rotate: true
|
||||
xy: 940, 880
|
||||
size: 54, 74
|
||||
orig: 54, 74
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_saddle_w_shadow
|
||||
raptor_saddle_w_shadow
|
||||
rotate: false
|
||||
xy: 195, 547
|
||||
size: 163, 188
|
||||
orig: 163, 188
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_tongue
|
||||
raptor_tongue
|
||||
rotate: true
|
||||
xy: 544, 649
|
||||
size: 86, 64
|
||||
orig: 86, 64
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/stirrup_back
|
||||
stirrup_back
|
||||
rotate: false
|
||||
xy: 458, 539
|
||||
size: 44, 35
|
||||
orig: 44, 35
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/stirrup_front
|
||||
stirrup_front
|
||||
rotate: true
|
||||
xy: 81, 4
|
||||
size: 45, 50
|
||||
orig: 45, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/stirrup_strap
|
||||
stirrup_strap
|
||||
rotate: true
|
||||
xy: 894, 828
|
||||
size: 49, 46
|
||||
orig: 49, 46
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/torso
|
||||
torso
|
||||
rotate: true
|
||||
xy: 610, 647
|
||||
size: 54, 91
|
||||
orig: 54, 91
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/visor
|
||||
visor
|
||||
rotate: false
|
||||
xy: 2, 51
|
||||
size: 131, 84
|
||||
|
||||
File diff suppressed because one or more lines are too long
251
spine-libgdx/assets/raptor/raptor.atlas
Normal file
251
spine-libgdx/assets/raptor/raptor.atlas
Normal file
@ -0,0 +1,251 @@
|
||||
|
||||
raptor.png
|
||||
size: 1022,1022
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
back_arm
|
||||
rotate: false
|
||||
xy: 410, 545
|
||||
size: 46, 29
|
||||
orig: 46, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
back_bracer
|
||||
rotate: false
|
||||
xy: 540, 548
|
||||
size: 39, 28
|
||||
orig: 39, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
back_hand
|
||||
rotate: true
|
||||
xy: 504, 538
|
||||
size: 36, 34
|
||||
orig: 36, 34
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
back_knee
|
||||
rotate: false
|
||||
xy: 299, 478
|
||||
size: 49, 67
|
||||
orig: 49, 67
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
back_thigh
|
||||
rotate: true
|
||||
xy: 140, 247
|
||||
size: 39, 24
|
||||
orig: 39, 24
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
eyes_open
|
||||
rotate: true
|
||||
xy: 2, 2
|
||||
size: 47, 45
|
||||
orig: 47, 45
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_arm
|
||||
rotate: false
|
||||
xy: 360, 544
|
||||
size: 48, 30
|
||||
orig: 48, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_bracer
|
||||
rotate: false
|
||||
xy: 538, 578
|
||||
size: 41, 29
|
||||
orig: 41, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_hand
|
||||
rotate: false
|
||||
xy: 538, 609
|
||||
size: 41, 38
|
||||
orig: 41, 38
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_open_hand
|
||||
rotate: false
|
||||
xy: 894, 782
|
||||
size: 43, 44
|
||||
orig: 43, 44
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_thigh
|
||||
rotate: false
|
||||
xy: 942, 849
|
||||
size: 57, 29
|
||||
orig: 57, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
gun
|
||||
rotate: false
|
||||
xy: 785, 774
|
||||
size: 107, 103
|
||||
orig: 107, 103
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
gun_nohand
|
||||
rotate: false
|
||||
xy: 614, 703
|
||||
size: 105, 102
|
||||
orig: 105, 102
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
head
|
||||
rotate: false
|
||||
xy: 2, 137
|
||||
size: 136, 149
|
||||
orig: 136, 149
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
lower_leg
|
||||
rotate: true
|
||||
xy: 780, 699
|
||||
size: 73, 98
|
||||
orig: 73, 98
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
mouth_smile
|
||||
rotate: true
|
||||
xy: 49, 2
|
||||
size: 47, 30
|
||||
orig: 47, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
neck
|
||||
rotate: true
|
||||
xy: 1001, 860
|
||||
size: 18, 21
|
||||
orig: 18, 21
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
raptor_arm_back
|
||||
rotate: false
|
||||
xy: 940, 936
|
||||
size: 82, 86
|
||||
orig: 82, 86
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
raptor_body
|
||||
rotate: false
|
||||
xy: 2, 737
|
||||
size: 610, 285
|
||||
orig: 610, 285
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
raptor_front_arm
|
||||
rotate: true
|
||||
xy: 195, 464
|
||||
size: 81, 102
|
||||
orig: 81, 102
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
raptor_front_leg
|
||||
rotate: false
|
||||
xy: 2, 478
|
||||
size: 191, 257
|
||||
orig: 191, 257
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
raptor_hindleg_back
|
||||
rotate: false
|
||||
xy: 614, 807
|
||||
size: 169, 215
|
||||
orig: 169, 215
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
raptor_horn
|
||||
rotate: false
|
||||
xy: 360, 655
|
||||
size: 182, 80
|
||||
orig: 182, 80
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
raptor_horn_back
|
||||
rotate: false
|
||||
xy: 360, 576
|
||||
size: 176, 77
|
||||
orig: 176, 77
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
raptor_jaw
|
||||
rotate: false
|
||||
xy: 785, 879
|
||||
size: 153, 143
|
||||
orig: 153, 143
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
raptor_saddle_noshadow
|
||||
rotate: false
|
||||
xy: 2, 288
|
||||
size: 163, 188
|
||||
orig: 163, 188
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
raptor_saddle_strap_front
|
||||
rotate: false
|
||||
xy: 721, 710
|
||||
size: 57, 95
|
||||
orig: 57, 95
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
raptor_saddle_strap_rear
|
||||
rotate: true
|
||||
xy: 940, 880
|
||||
size: 54, 74
|
||||
orig: 54, 74
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
raptor_saddle_w_shadow
|
||||
rotate: false
|
||||
xy: 195, 547
|
||||
size: 163, 188
|
||||
orig: 163, 188
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
raptor_tongue
|
||||
rotate: true
|
||||
xy: 544, 649
|
||||
size: 86, 64
|
||||
orig: 86, 64
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
stirrup_back
|
||||
rotate: false
|
||||
xy: 458, 539
|
||||
size: 44, 35
|
||||
orig: 44, 35
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
stirrup_front
|
||||
rotate: true
|
||||
xy: 81, 4
|
||||
size: 45, 50
|
||||
orig: 45, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
stirrup_strap
|
||||
rotate: true
|
||||
xy: 894, 828
|
||||
size: 49, 46
|
||||
orig: 49, 46
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
torso
|
||||
rotate: true
|
||||
xy: 610, 647
|
||||
size: 54, 91
|
||||
orig: 54, 91
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
visor
|
||||
rotate: false
|
||||
xy: 2, 51
|
||||
size: 131, 84
|
||||
orig: 131, 84
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
1333
spine-libgdx/assets/raptor/raptor.json
Normal file
1333
spine-libgdx/assets/raptor/raptor.json
Normal file
File diff suppressed because one or more lines are too long
BIN
spine-libgdx/assets/raptor/raptor.png
Normal file
BIN
spine-libgdx/assets/raptor/raptor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 487 KiB |
BIN
spine-libgdx/assets/raptor/raptor.skel
Normal file
BIN
spine-libgdx/assets/raptor/raptor.skel
Normal file
Binary file not shown.
@ -52,7 +52,7 @@ public class SimpleTest1 extends ApplicationAdapter {
|
||||
camera = new OrthographicCamera();
|
||||
batch = new SpriteBatch();
|
||||
renderer = new SkeletonRenderer();
|
||||
renderer.setPremultipliedAlpha(true);
|
||||
renderer.setPremultipliedAlpha(true); // PMA results in correct blending without outlines.
|
||||
debugRenderer = new SkeletonRendererDebug();
|
||||
debugRenderer.setBoundingBoxes(false);
|
||||
debugRenderer.setRegionAttachments(false);
|
||||
@ -71,6 +71,8 @@ public class SimpleTest1 extends ApplicationAdapter {
|
||||
|
||||
state = new AnimationState(stateData); // Holds the animation state for a skeleton (current animation, time, etc).
|
||||
state.setTimeScale(0.5f); // Slow all animations down to 50% speed.
|
||||
|
||||
// Queue animations on track 0.
|
||||
state.setAnimation(0, "run", true);
|
||||
state.addAnimation(0, "jump", false, 2); // Jump after 2 seconds.
|
||||
state.addAnimation(0, "run", true, 0); // Run after the jump.
|
||||
|
||||
@ -98,6 +98,8 @@ public class SimpleTest2 extends ApplicationAdapter {
|
||||
System.out.println(trackIndex + " end: " + state.getCurrent(trackIndex));
|
||||
}
|
||||
});
|
||||
|
||||
// Set animation on track 0.
|
||||
state.setAnimation(0, "run", true);
|
||||
|
||||
Gdx.input.setInputProcessor(new InputAdapter() {
|
||||
|
||||
111
spine-libgdx/test/com/esotericsoftware/spine/SimpleTest3.java
Normal file
111
spine-libgdx/test/com/esotericsoftware/spine/SimpleTest3.java
Normal file
@ -0,0 +1,111 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License
|
||||
* Version 2.1
|
||||
*
|
||||
* Copyright (c) 2013, Esoteric Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* You are granted a perpetual, non-exclusive, non-sublicensable and
|
||||
* non-transferable license to install, execute and perform the Spine Runtimes
|
||||
* Software (the "Software") solely for internal use. Without the written
|
||||
* permission of Esoteric Software (typically granted by licensing Spine), you
|
||||
* may not (a) modify, translate, adapt or otherwise create derivative works,
|
||||
* improvements of the Software or develop new applications using the Software
|
||||
* or (b) remove, delete, alter or obscure any trademarks or any copyright,
|
||||
* trademark, patent or other intellectual property or proprietary rights
|
||||
* notices on or in the Software, including any copy thereof. Redistributions
|
||||
* in binary or source form must include this license and terms.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
package com.esotericsoftware.spine;
|
||||
|
||||
import com.badlogic.gdx.ApplicationAdapter;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
|
||||
public class SimpleTest3 extends ApplicationAdapter {
|
||||
OrthographicCamera camera;
|
||||
PolygonSpriteBatch batch;
|
||||
SkeletonRenderer renderer;
|
||||
SkeletonRendererDebug debugRenderer;
|
||||
|
||||
TextureAtlas atlas;
|
||||
Skeleton skeleton;
|
||||
AnimationState state;
|
||||
|
||||
public void create () {
|
||||
camera = new OrthographicCamera();
|
||||
batch = new PolygonSpriteBatch(); // Required to render meshes. SpriteBatch can't render meshes.
|
||||
renderer = new SkeletonRenderer();
|
||||
renderer.setPremultipliedAlpha(true);
|
||||
debugRenderer = new SkeletonRendererDebug();
|
||||
debugRenderer.setMeshTriangles(false);
|
||||
debugRenderer.setRegionAttachments(false);
|
||||
debugRenderer.setMeshHull(false);
|
||||
|
||||
atlas = new TextureAtlas(Gdx.files.internal("raptor/raptor.atlas"));
|
||||
SkeletonJson json = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
|
||||
json.setScale(0.5f); // Load the skeleton at 50% the size it was in Spine.
|
||||
SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("raptor/raptor.json"));
|
||||
|
||||
skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
|
||||
skeleton.setPosition(250, 20);
|
||||
|
||||
AnimationStateData stateData = new AnimationStateData(skeletonData); // Defines mixing (crossfading) between animations.
|
||||
|
||||
state = new AnimationState(stateData); // Holds the animation state for a skeleton (current animation, time, etc).
|
||||
state.setTimeScale(0.6f); // Slow all animations down to 60% speed.
|
||||
|
||||
// Queue animations on tracks 0 and 1.
|
||||
state.setAnimation(0, "walk", true);
|
||||
state.setAnimation(1, "empty", false);
|
||||
state.addAnimation(1, "gungrab", false, 2); // Keys in higher tracks override the pose from lower tracks.
|
||||
}
|
||||
|
||||
public void render () {
|
||||
state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.
|
||||
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
state.apply(skeleton); // Poses skeleton using current animations. This sets the bones' local SRT.
|
||||
skeleton.updateWorldTransform(); // Uses the bones' local SRT to compute their world SRT.
|
||||
|
||||
// Configure the camera, SpriteBatch, and SkeletonRendererDebug.
|
||||
camera.update();
|
||||
batch.getProjectionMatrix().set(camera.combined);
|
||||
debugRenderer.getShapeRenderer().setProjectionMatrix(camera.combined);
|
||||
|
||||
batch.begin();
|
||||
renderer.draw(batch, skeleton); // Draw the skeleton images.
|
||||
batch.end();
|
||||
|
||||
debugRenderer.draw(skeleton); // Draw debug lines.
|
||||
}
|
||||
|
||||
public void resize (int width, int height) {
|
||||
camera.setToOrtho(false); // Update camera with new size.
|
||||
}
|
||||
|
||||
public void dispose () {
|
||||
atlas.dispose();
|
||||
}
|
||||
|
||||
public static void main (String[] args) throws Exception {
|
||||
new LwjglApplication(new SimpleTest3());
|
||||
}
|
||||
}
|
||||
@ -4,245 +4,245 @@ size: 1022,1022
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
images/back_arm
|
||||
back_arm
|
||||
rotate: false
|
||||
xy: 410, 545
|
||||
size: 46, 29
|
||||
orig: 46, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/back_bracer
|
||||
back_bracer
|
||||
rotate: false
|
||||
xy: 540, 548
|
||||
size: 39, 28
|
||||
orig: 39, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/back_hand
|
||||
back_hand
|
||||
rotate: true
|
||||
xy: 504, 538
|
||||
size: 36, 34
|
||||
orig: 36, 34
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/back_knee
|
||||
back_knee
|
||||
rotate: false
|
||||
xy: 299, 478
|
||||
size: 49, 67
|
||||
orig: 49, 67
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/back_thigh
|
||||
back_thigh
|
||||
rotate: true
|
||||
xy: 140, 247
|
||||
size: 39, 24
|
||||
orig: 39, 24
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/eyes_open
|
||||
eyes_open
|
||||
rotate: true
|
||||
xy: 2, 2
|
||||
size: 47, 45
|
||||
orig: 47, 45
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/front_arm
|
||||
front_arm
|
||||
rotate: false
|
||||
xy: 360, 544
|
||||
size: 48, 30
|
||||
orig: 48, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/front_bracer
|
||||
front_bracer
|
||||
rotate: false
|
||||
xy: 538, 578
|
||||
size: 41, 29
|
||||
orig: 41, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/front_hand
|
||||
front_hand
|
||||
rotate: false
|
||||
xy: 538, 609
|
||||
size: 41, 38
|
||||
orig: 41, 38
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/front_open_hand
|
||||
front_open_hand
|
||||
rotate: false
|
||||
xy: 894, 782
|
||||
size: 43, 44
|
||||
orig: 43, 44
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/front_thigh
|
||||
front_thigh
|
||||
rotate: false
|
||||
xy: 942, 849
|
||||
size: 57, 29
|
||||
orig: 57, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/gun
|
||||
gun
|
||||
rotate: false
|
||||
xy: 785, 774
|
||||
size: 107, 103
|
||||
orig: 107, 103
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/gun_nohand
|
||||
gun_nohand
|
||||
rotate: false
|
||||
xy: 614, 703
|
||||
size: 105, 102
|
||||
orig: 105, 102
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/head
|
||||
head
|
||||
rotate: false
|
||||
xy: 2, 137
|
||||
size: 136, 149
|
||||
orig: 136, 149
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/lower_leg
|
||||
lower_leg
|
||||
rotate: true
|
||||
xy: 780, 699
|
||||
size: 73, 98
|
||||
orig: 73, 98
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/mouth_smile
|
||||
mouth_smile
|
||||
rotate: true
|
||||
xy: 49, 2
|
||||
size: 47, 30
|
||||
orig: 47, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/neck
|
||||
neck
|
||||
rotate: true
|
||||
xy: 1001, 860
|
||||
size: 18, 21
|
||||
orig: 18, 21
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_arm_back
|
||||
raptor_arm_back
|
||||
rotate: false
|
||||
xy: 940, 936
|
||||
size: 82, 86
|
||||
orig: 82, 86
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_body
|
||||
raptor_body
|
||||
rotate: false
|
||||
xy: 2, 737
|
||||
size: 610, 285
|
||||
orig: 610, 285
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_front_arm
|
||||
raptor_front_arm
|
||||
rotate: true
|
||||
xy: 195, 464
|
||||
size: 81, 102
|
||||
orig: 81, 102
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_front_leg
|
||||
raptor_front_leg
|
||||
rotate: false
|
||||
xy: 2, 478
|
||||
size: 191, 257
|
||||
orig: 191, 257
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_hindleg_back
|
||||
raptor_hindleg_back
|
||||
rotate: false
|
||||
xy: 614, 807
|
||||
size: 169, 215
|
||||
orig: 169, 215
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_horn
|
||||
raptor_horn
|
||||
rotate: false
|
||||
xy: 360, 655
|
||||
size: 182, 80
|
||||
orig: 182, 80
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_horn_back
|
||||
raptor_horn_back
|
||||
rotate: false
|
||||
xy: 360, 576
|
||||
size: 176, 77
|
||||
orig: 176, 77
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_jaw
|
||||
raptor_jaw
|
||||
rotate: false
|
||||
xy: 785, 879
|
||||
size: 153, 143
|
||||
orig: 153, 143
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_saddle_noshadow
|
||||
raptor_saddle_noshadow
|
||||
rotate: false
|
||||
xy: 2, 288
|
||||
size: 163, 188
|
||||
orig: 163, 188
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_saddle_strap_front
|
||||
raptor_saddle_strap_front
|
||||
rotate: false
|
||||
xy: 721, 710
|
||||
size: 57, 95
|
||||
orig: 57, 95
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_saddle_strap_rear
|
||||
raptor_saddle_strap_rear
|
||||
rotate: true
|
||||
xy: 940, 880
|
||||
size: 54, 74
|
||||
orig: 54, 74
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_saddle_w_shadow
|
||||
raptor_saddle_w_shadow
|
||||
rotate: false
|
||||
xy: 195, 547
|
||||
size: 163, 188
|
||||
orig: 163, 188
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/raptor_tongue
|
||||
raptor_tongue
|
||||
rotate: true
|
||||
xy: 544, 649
|
||||
size: 86, 64
|
||||
orig: 86, 64
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/stirrup_back
|
||||
stirrup_back
|
||||
rotate: false
|
||||
xy: 458, 539
|
||||
size: 44, 35
|
||||
orig: 44, 35
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/stirrup_front
|
||||
stirrup_front
|
||||
rotate: true
|
||||
xy: 81, 4
|
||||
size: 45, 50
|
||||
orig: 45, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/stirrup_strap
|
||||
stirrup_strap
|
||||
rotate: true
|
||||
xy: 894, 828
|
||||
size: 49, 46
|
||||
orig: 49, 46
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/torso
|
||||
torso
|
||||
rotate: true
|
||||
xy: 610, 647
|
||||
size: 54, 91
|
||||
orig: 54, 91
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/visor
|
||||
visor
|
||||
rotate: false
|
||||
xy: 2, 51
|
||||
size: 131, 84
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -144,7 +144,6 @@ void goblins () {
|
||||
printf("Error: %s\n", json->error);
|
||||
exit(0);
|
||||
}
|
||||
Animation* walkAnimation = SkeletonData_findAnimation(skeletonData, "walk");
|
||||
SkeletonJson_dispose(json);
|
||||
|
||||
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
|
||||
@ -161,7 +160,7 @@ void goblins () {
|
||||
skeleton->y = 590;
|
||||
Skeleton_updateWorldTransform(skeleton);
|
||||
|
||||
AnimationState_setAnimation(drawable->state, 0, walkAnimation, true);
|
||||
AnimationState_setAnimationByName(drawable->state, 0, "walk", true);
|
||||
|
||||
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - goblins");
|
||||
window.setFramerateLimit(60);
|
||||
@ -195,7 +194,6 @@ void raptor () {
|
||||
printf("Error: %s\n", json->error);
|
||||
exit(0);
|
||||
}
|
||||
Animation* walkAnimation = SkeletonData_findAnimation(skeletonData, "walk");
|
||||
SkeletonJson_dispose(json);
|
||||
|
||||
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
|
||||
@ -206,7 +204,9 @@ void raptor () {
|
||||
skeleton->y = 590;
|
||||
Skeleton_updateWorldTransform(skeleton);
|
||||
|
||||
AnimationState_setAnimation(drawable->state, 0, walkAnimation, true);
|
||||
AnimationState_setAnimationByName(drawable->state, 0, "walk", true);
|
||||
AnimationState_setAnimationByName(drawable->state, 1, "empty", false);
|
||||
AnimationState_addAnimationByName(drawable->state, 1, "gungrab", false, 2);
|
||||
|
||||
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - raptor");
|
||||
window.setFramerateLimit(60);
|
||||
|
||||
@ -71,6 +71,10 @@ SkeletonDrawable::SkeletonDrawable (SkeletonData* skeletonData, AnimationStateDa
|
||||
Bone_setYDown(true);
|
||||
worldVertices = MALLOC(float, SPINE_MESH_VERTEX_COUNT_MAX);
|
||||
skeleton = Skeleton_create(skeletonData);
|
||||
|
||||
ownsAnimationStateData = stateData == 0;
|
||||
if (ownsAnimationStateData) stateData = AnimationStateData_create(skeletonData);
|
||||
|
||||
state = AnimationState_create(stateData);
|
||||
}
|
||||
|
||||
@ -78,6 +82,7 @@ SkeletonDrawable::~SkeletonDrawable () {
|
||||
delete vertexArray;
|
||||
FREE(worldVertices);
|
||||
AnimationState_dispose(state);
|
||||
if (ownsAnimationStateData) AnimationStateData_dispose(state->data);
|
||||
Skeleton_dispose(skeleton);
|
||||
}
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@ public:
|
||||
|
||||
virtual void draw (sf::RenderTarget& target, sf::RenderStates states) const;
|
||||
private:
|
||||
bool ownsAnimationStateData;
|
||||
float* worldVertices;
|
||||
};
|
||||
|
||||
|
||||
Binary file not shown.
13
spine-unity/Assets/Examples/Scripts/Raptor.cs
Normal file
13
spine-unity/Assets/Examples/Scripts/Raptor.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class Raptor : MonoBehaviour {
|
||||
public void Start () {
|
||||
// Get the SkeletonAnimation component for the GameObject this script is attached to.
|
||||
SkeletonAnimation skeletonAnimation = GetComponent<SkeletonAnimation>();
|
||||
// Set an animation on track 1 that does nothing to be played first.
|
||||
skeletonAnimation.state.SetAnimation(1, "empty", false);
|
||||
// Queue gun grab to be played on track 1 two seconds later.
|
||||
skeletonAnimation.state.AddAnimation(1, "gungrab", false, 2);
|
||||
}
|
||||
}
|
||||
8
spine-unity/Assets/Examples/Scripts/Raptor.cs.meta
Normal file
8
spine-unity/Assets/Examples/Scripts/Raptor.cs.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b0d38dc0b91fb443a41838d475ae49b
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
Loading…
x
Reference in New Issue
Block a user