mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge branch '4.1' into 4.2-beta
# Conflicts: # spine-ts/package-lock.json # spine-ts/package.json # spine-ts/spine-canvas/package.json # spine-ts/spine-core/package.json # spine-ts/spine-phaser/package.json # spine-ts/spine-pixi/package.json # spine-ts/spine-player/package.json # spine-ts/spine-threejs/package.json # spine-ts/spine-webgl/package.json
This commit is contained in:
commit
db914b023f
@ -115,7 +115,7 @@ Ref<SpineBone> SpineSkeleton::find_bone(const String &name) {
|
|||||||
if (EMPTY(name)) return nullptr;
|
if (EMPTY(name)) return nullptr;
|
||||||
auto bone = skeleton->findBone(SPINE_STRING_TMP(name));
|
auto bone = skeleton->findBone(SPINE_STRING_TMP(name));
|
||||||
if (!bone) return nullptr;
|
if (!bone) return nullptr;
|
||||||
if (_cached_bones.count(bone) > 0 ) {
|
if (_cached_bones.count(bone) > 0) {
|
||||||
return _cached_bones[bone];
|
return _cached_bones[bone];
|
||||||
}
|
}
|
||||||
Ref<SpineBone> bone_ref(memnew(SpineBone));
|
Ref<SpineBone> bone_ref(memnew(SpineBone));
|
||||||
@ -129,7 +129,7 @@ Ref<SpineSlot> SpineSkeleton::find_slot(const String &name) {
|
|||||||
if (EMPTY(name)) return nullptr;
|
if (EMPTY(name)) return nullptr;
|
||||||
auto slot = skeleton->findSlot(SPINE_STRING_TMP(name));
|
auto slot = skeleton->findSlot(SPINE_STRING_TMP(name));
|
||||||
if (!slot) return nullptr;
|
if (!slot) return nullptr;
|
||||||
if (_cached_slots.count(slot) > 0 ) {
|
if (_cached_slots.count(slot) > 0) {
|
||||||
return _cached_slots[slot];
|
return _cached_slots[slot];
|
||||||
}
|
}
|
||||||
Ref<SpineSlot> slot_ref(memnew(SpineSlot));
|
Ref<SpineSlot> slot_ref(memnew(SpineSlot));
|
||||||
|
|||||||
@ -68,8 +68,8 @@ private:
|
|||||||
spine::Vector<float> bounds_vertex_buffer;
|
spine::Vector<float> bounds_vertex_buffer;
|
||||||
Ref<SpineSkin> last_skin;
|
Ref<SpineSkin> last_skin;
|
||||||
|
|
||||||
std::unordered_map<spine::Bone*, Ref<SpineBone>> _cached_bones;
|
std::unordered_map<spine::Bone *, Ref<SpineBone>> _cached_bones;
|
||||||
std::unordered_map<spine::Slot*, Ref<SpineSlot>> _cached_slots;
|
std::unordered_map<spine::Slot *, Ref<SpineSlot>> _cached_slots;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SpineSkeleton();
|
SpineSkeleton();
|
||||||
|
|||||||
@ -59,10 +59,9 @@ void SpineSlot::set_to_setup_pose() {
|
|||||||
|
|
||||||
Ref<SpineSlotData> SpineSlot::get_data() {
|
Ref<SpineSlotData> SpineSlot::get_data() {
|
||||||
SPINE_CHECK(get_spine_object(), nullptr)
|
SPINE_CHECK(get_spine_object(), nullptr)
|
||||||
if(_data.is_valid()) {
|
if (_data.is_valid()) {
|
||||||
return _data;
|
return _data;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
auto &slot_data = get_spine_object()->getData();
|
auto &slot_data = get_spine_object()->getData();
|
||||||
Ref<SpineSlotData> slot_data_ref(memnew(SpineSlotData));
|
Ref<SpineSlotData> slot_data_ref(memnew(SpineSlotData));
|
||||||
slot_data_ref->set_spine_object(*get_spine_owner()->get_skeleton_data_res(), &slot_data);
|
slot_data_ref->set_spine_object(*get_spine_owner()->get_skeleton_data_res(), &slot_data);
|
||||||
@ -73,10 +72,9 @@ Ref<SpineSlotData> SpineSlot::get_data() {
|
|||||||
|
|
||||||
Ref<SpineBone> SpineSlot::get_bone() {
|
Ref<SpineBone> SpineSlot::get_bone() {
|
||||||
SPINE_CHECK(get_spine_object(), nullptr)
|
SPINE_CHECK(get_spine_object(), nullptr)
|
||||||
if(_bone.is_valid()) {
|
if (_bone.is_valid()) {
|
||||||
return _data;
|
return _data;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
auto &bone = get_spine_object()->getBone();
|
auto &bone = get_spine_object()->getBone();
|
||||||
Ref<SpineBone> bone_ref(memnew(SpineBone));
|
Ref<SpineBone> bone_ref(memnew(SpineBone));
|
||||||
bone_ref->set_spine_object(get_spine_owner(), &bone);
|
bone_ref->set_spine_object(get_spine_owner(), &bone);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<script src="../dist/iife/spine-phaser.js"></script>
|
<script src="../dist/iife/spine-phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<script src="../dist/iife/spine-phaser.js"></script>
|
<script src="../dist/iife/spine-phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<script src="https://unpkg.com/@esotericsoftware/spine-phaser@4.1.*/dist/iife/spine-phaser.min.js"></script>
|
<script src="https://unpkg.com/@esotericsoftware/spine-phaser@4.1.*/dist/iife/spine-phaser.min.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@ -5,14 +5,14 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<script src="../dist/iife/spine-phaser.js"></script>
|
<script src="../dist/iife/spine-phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>Control bones</h1>
|
<h1>Control bones</h1>
|
||||||
<script>
|
<script>
|
||||||
class ControlBonesExample extends Phaser.Scene {
|
class ControlBonesExample extends Phaser.Scene {
|
||||||
preload() {
|
preload() {
|
||||||
this.load.spineBinary("stretchyman-data", "assets/stretchyman-pro.skel");
|
this.load.spineBinary("stretchyman-data", "assets/stretchyman-pro.skel");
|
||||||
@ -20,7 +20,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
create() {
|
create() {
|
||||||
const stretchyman = this.add.spine(400, 580, 'stretchyman-data', "stretchyman-atlas");
|
const stretchyman = this.add.spine(400, 580, 'stretchyman-data', "stretchyman-atlas");
|
||||||
stretchyman.animationState.setAnimation(0, "idle", true);
|
stretchyman.animationState.setAnimation(0, "idle", true);
|
||||||
stretchyman.updatePose(0);
|
stretchyman.updatePose(0);
|
||||||
|
|
||||||
@ -38,12 +38,12 @@
|
|||||||
this.input.setDraggable(control);
|
this.input.setDraggable(control);
|
||||||
this.input.on('drag', function (pointer, gameObject, dragX, dragY) {
|
this.input.on('drag', function (pointer, gameObject, dragX, dragY) {
|
||||||
gameObject.x = dragX;
|
gameObject.x = dragX;
|
||||||
gameObject.y = dragY;
|
gameObject.y = dragY;
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
stretchyman.beforeUpdateWorldTransforms = () => {
|
stretchyman.beforeUpdateWorldTransforms = () => {
|
||||||
for (let controlBone of controlBones) {
|
for (let controlBone of controlBones) {
|
||||||
const bone = controlBone.getData('bone');
|
const bone = controlBone.getData('bone');
|
||||||
const point = { x: controlBone.x, y: controlBone.y};
|
const point = { x: controlBone.x, y: controlBone.y};
|
||||||
stretchyman.phaserWorldCoordinatesToBone(point, bone);
|
stretchyman.phaserWorldCoordinatesToBone(point, bone);
|
||||||
@ -65,7 +65,7 @@
|
|||||||
{ key: "spine.SpinePlugin", plugin: spine.SpinePlugin, mapping: "spine" }
|
{ key: "spine.SpinePlugin", plugin: spine.SpinePlugin, mapping: "spine" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<script src="../dist/iife/spine-phaser.js"></script>
|
<script src="../dist/iife/spine-phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<script src="../dist/iife/spine-phaser.js"></script>
|
<script src="../dist/iife/spine-phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
<textarea id="log" style="height: 10em;"></textarea>
|
<textarea id="log" style="height: 10em;"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
function log(message) {
|
function log(message) {
|
||||||
let log = document.querySelector("#log");
|
let log = document.querySelector("#log");
|
||||||
log.textContent += message + "\n";
|
log.textContent += message + "\n";
|
||||||
@ -40,7 +40,7 @@
|
|||||||
interrupt: (entry) => log(`Interrupted animation ${entry.animation.name}`),
|
interrupt: (entry) => log(`Interrupted animation ${entry.animation.name}`),
|
||||||
end: (entry) => log(`Ended animation ${entry.animation.name}`),
|
end: (entry) => log(`Ended animation ${entry.animation.name}`),
|
||||||
dispose: (entry) => log(`Disposed animation ${entry.animation.name}`),
|
dispose: (entry) => log(`Disposed animation ${entry.animation.name}`),
|
||||||
complete: (entry) => log(`Completed animation ${entry.animation.name}`),
|
complete: (entry) => log(`Completed animation ${entry.animation.name}`),
|
||||||
})
|
})
|
||||||
|
|
||||||
spineboy.animationState.setAnimation(0, "walk", true);
|
spineboy.animationState.setAnimation(0, "walk", true);
|
||||||
@ -51,7 +51,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
canvas: document.querySelector("#game"),
|
canvas: document.querySelector("#game"),
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 600,
|
height: 600,
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<script src="../dist/iife/spine-phaser.js"></script>
|
<script src="../dist/iife/spine-phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<script src="../dist/iife/spine-phaser.js"></script>
|
<script src="../dist/iife/spine-phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -37,7 +37,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function create() {
|
function create() {
|
||||||
const renderTexture = this.add.renderTexture(0, 0, 800, 600);
|
const renderTexture = this.add.renderTexture(400, 300, 800, 600);
|
||||||
const spineboy = this.add.spine(400, 300, 'spineboy-data', "spineboy-atlas");
|
const spineboy = this.add.spine(400, 300, 'spineboy-data', "spineboy-atlas");
|
||||||
spineboy.scale = 0.5;
|
spineboy.scale = 0.5;
|
||||||
spineboy.animationState.setAnimation(0, "walk", true);
|
spineboy.animationState.setAnimation(0, "walk", true);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||||
<script src="../dist/iife/spine-phaser.js"></script>
|
<script src="../dist/iife/spine-phaser.js"></script>
|
||||||
<title>Spine Phaser Example</title>
|
<title>Spine Phaser Example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@ -76,7 +76,7 @@ export class SpinePlugin extends Phaser.Plugins.ScenePlugin {
|
|||||||
private isWebGL: boolean;
|
private isWebGL: boolean;
|
||||||
gl: WebGLRenderingContext | null;
|
gl: WebGLRenderingContext | null;
|
||||||
static gameWebGLRenderer: SceneRenderer | null = null;
|
static gameWebGLRenderer: SceneRenderer | null = null;
|
||||||
get webGLRenderer(): SceneRenderer | null {
|
get webGLRenderer (): SceneRenderer | null {
|
||||||
return SpinePlugin.gameWebGLRenderer;
|
return SpinePlugin.gameWebGLRenderer;
|
||||||
}
|
}
|
||||||
canvasRenderer: SkeletonRenderer | null;
|
canvasRenderer: SkeletonRenderer | null;
|
||||||
@ -124,7 +124,7 @@ export class SpinePlugin extends Phaser.Plugins.ScenePlugin {
|
|||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
let addSpineGameObject = function (this: Phaser.GameObjects.GameObjectFactory, x: number, y: number, dataKey: string, atlasKey: string, boundsProvider: SpineGameObjectBoundsProvider) {
|
let addSpineGameObject = function (this: Phaser.GameObjects.GameObjectFactory, x: number, y: number, dataKey: string, atlasKey: string, boundsProvider: SpineGameObjectBoundsProvider) {
|
||||||
let gameObject = new SpineGameObject(scene, self, x, y, dataKey, atlasKey, boundsProvider);
|
let gameObject = new SpineGameObject(this.scene, self, x, y, dataKey, atlasKey, boundsProvider);
|
||||||
this.displayList.add(gameObject);
|
this.displayList.add(gameObject);
|
||||||
this.updateList.add(gameObject);
|
this.updateList.add(gameObject);
|
||||||
return gameObject;
|
return gameObject;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user