mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Renamed SkeletonAnimationSprite -> SkeletonAnimation. Versioned starling SWC file name.
This commit is contained in:
parent
335259f954
commit
ed6634b641
@ -9,7 +9,7 @@ import spine.SkeletonJson;
|
|||||||
import spine.atlas.Atlas;
|
import spine.atlas.Atlas;
|
||||||
import spine.attachments.AtlasAttachmentLoader;
|
import spine.attachments.AtlasAttachmentLoader;
|
||||||
import spine.flash.SingleTextureLoader;
|
import spine.flash.SingleTextureLoader;
|
||||||
import spine.flash.SkeletonAnimationSprite;
|
import spine.flash.SkeletonAnimation;
|
||||||
|
|
||||||
[SWF(width = "640", height = "480", frameRate = "60", backgroundColor = "#dddddd")]
|
[SWF(width = "640", height = "480", frameRate = "60", backgroundColor = "#dddddd")]
|
||||||
public class Main extends Sprite {
|
public class Main extends Sprite {
|
||||||
@ -22,7 +22,7 @@ public class Main extends Sprite {
|
|||||||
[Embed(source = "spineboy.json", mimeType = "application/octet-stream")]
|
[Embed(source = "spineboy.json", mimeType = "application/octet-stream")]
|
||||||
static public const SpineboyJson:Class;
|
static public const SpineboyJson:Class;
|
||||||
|
|
||||||
private var skeleton:SkeletonAnimationSprite;
|
private var skeleton:SkeletonAnimation;
|
||||||
|
|
||||||
public function Main () {
|
public function Main () {
|
||||||
var atlas:Atlas = new Atlas(new SpineboyAtlas(), new SingleTextureLoader(new SpineboyAtlasTexture()));
|
var atlas:Atlas = new Atlas(new SpineboyAtlas(), new SingleTextureLoader(new SpineboyAtlasTexture()));
|
||||||
@ -34,7 +34,7 @@ public class Main extends Sprite {
|
|||||||
stateData.setMixByName("jump", "walk", 0.4);
|
stateData.setMixByName("jump", "walk", 0.4);
|
||||||
stateData.setMixByName("jump", "jump", 0.2);
|
stateData.setMixByName("jump", "jump", 0.2);
|
||||||
|
|
||||||
skeleton = new SkeletonAnimationSprite(skeletonData);
|
skeleton = new SkeletonAnimation(skeletonData);
|
||||||
skeleton.setAnimationStateData(stateData);
|
skeleton.setAnimationStateData(stateData);
|
||||||
skeleton.x = 320;
|
skeleton.x = 320;
|
||||||
skeleton.y = 420;
|
skeleton.y = 420;
|
||||||
|
|||||||
@ -3,10 +3,10 @@ import spine.AnimationState;
|
|||||||
import spine.AnimationStateData;
|
import spine.AnimationStateData;
|
||||||
import spine.SkeletonData;
|
import spine.SkeletonData;
|
||||||
|
|
||||||
public class SkeletonAnimationSprite extends SkeletonSprite {
|
public class SkeletonAnimation extends SkeletonSprite {
|
||||||
public var states:Vector.<AnimationState> = new Vector.<AnimationState>();
|
public var states:Vector.<AnimationState> = new Vector.<AnimationState>();
|
||||||
|
|
||||||
public function SkeletonAnimationSprite (skeletonData:SkeletonData) {
|
public function SkeletonAnimation (skeletonData:SkeletonData) {
|
||||||
super(skeletonData);
|
super(skeletonData);
|
||||||
addAnimationState();
|
addAnimationState();
|
||||||
}
|
}
|
||||||
@ -10,7 +10,7 @@
|
|||||||
</excludedEntries>
|
</excludedEntries>
|
||||||
</libraryPathEntry>
|
</libraryPathEntry>
|
||||||
<libraryPathEntry kind="3" linkType="1" path="/spine-as3/bin/spine-as3.swc" useDefaultLinkType="false"/>
|
<libraryPathEntry kind="3" linkType="1" path="/spine-as3/bin/spine-as3.swc" useDefaultLinkType="false"/>
|
||||||
<libraryPathEntry kind="3" linkType="1" path="libs/starling.swc" useDefaultLinkType="false"/>
|
<libraryPathEntry kind="3" linkType="1" path="libs/starling-1.3.swc" useDefaultLinkType="false"/>
|
||||||
</libraryPath>
|
</libraryPath>
|
||||||
<sourceAttachmentPath/>
|
<sourceAttachmentPath/>
|
||||||
</compiler>
|
</compiler>
|
||||||
|
|||||||
@ -3,10 +3,10 @@ package spine.starling {
|
|||||||
import spine.AnimationStateData;
|
import spine.AnimationStateData;
|
||||||
import spine.SkeletonData;
|
import spine.SkeletonData;
|
||||||
|
|
||||||
public class SkeletonAnimationSprite extends SkeletonSprite {
|
public class SkeletonAnimation extends SkeletonSprite {
|
||||||
public var states:Vector.<AnimationState> = new Vector.<AnimationState>();
|
public var states:Vector.<AnimationState> = new Vector.<AnimationState>();
|
||||||
|
|
||||||
public function SkeletonAnimationSprite (skeletonData:SkeletonData) {
|
public function SkeletonAnimation (skeletonData:SkeletonData) {
|
||||||
super(skeletonData);
|
super(skeletonData);
|
||||||
addAnimationState();
|
addAnimationState();
|
||||||
}
|
}
|
||||||
@ -35,6 +35,7 @@ public class SkeletonSprite extends DisplayObject implements IAnimatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override public function render (support:RenderSupport, alpha:Number) : void {
|
override public function render (support:RenderSupport, alpha:Number) : void {
|
||||||
|
alpha *= this.alpha * skeleton.a;
|
||||||
var drawOrder:Vector.<Slot> = skeleton.drawOrder;
|
var drawOrder:Vector.<Slot> = skeleton.drawOrder;
|
||||||
for (var i:int = 0, n:int = drawOrder.length; i < n; i++) {
|
for (var i:int = 0, n:int = drawOrder.length; i < n; i++) {
|
||||||
var slot:Slot = drawOrder[i];
|
var slot:Slot = drawOrder[i];
|
||||||
@ -45,7 +46,7 @@ public class SkeletonSprite extends DisplayObject implements IAnimatable {
|
|||||||
var r:Number = skeleton.r * slot.r;
|
var r:Number = skeleton.r * slot.r;
|
||||||
var g:Number = skeleton.g * slot.g;
|
var g:Number = skeleton.g * slot.g;
|
||||||
var b:Number = skeleton.b * slot.b;
|
var b:Number = skeleton.b * slot.b;
|
||||||
var a:Number = skeleton.a * slot.a;
|
var a:Number = slot.a;
|
||||||
|
|
||||||
var image:SkeletonImage = regionAttachment.rendererObject as SkeletonImage;
|
var image:SkeletonImage = regionAttachment.rendererObject as SkeletonImage;
|
||||||
var vertexData:Vector.<Number> = image.vertexData.rawData;
|
var vertexData:Vector.<Number> = image.vertexData.rawData;
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
package spine.starling {
|
package spine.starling {
|
||||||
|
import flash.geom.Rectangle;
|
||||||
|
|
||||||
import spine.Bone;
|
import spine.Bone;
|
||||||
import spine.Skin;
|
import spine.Skin;
|
||||||
import spine.attachments.Attachment;
|
import spine.attachments.Attachment;
|
||||||
@ -22,11 +24,13 @@ public class StarlingAtlasAttachmentLoader implements AttachmentLoader {
|
|||||||
if (type == AttachmentType.region) {
|
if (type == AttachmentType.region) {
|
||||||
var regionAttachment:RegionAttachment = new RegionAttachment(name);
|
var regionAttachment:RegionAttachment = new RegionAttachment(name);
|
||||||
var texture:Texture = atlas.getTexture(name);
|
var texture:Texture = atlas.getTexture(name);
|
||||||
|
var frame:Rectangle = texture.frame;
|
||||||
|
texture = Texture.fromTexture(texture); // Discard frame.
|
||||||
regionAttachment.rendererObject = new SkeletonImage(texture);
|
regionAttachment.rendererObject = new SkeletonImage(texture);
|
||||||
regionAttachment.regionOffsetX = texture.frame.x;
|
regionAttachment.regionOffsetX = frame.x;
|
||||||
regionAttachment.regionOffsetY = texture.frame.y;
|
regionAttachment.regionOffsetY = frame.y;
|
||||||
regionAttachment.regionWidth = texture.width;
|
regionAttachment.regionWidth = frame.width;
|
||||||
regionAttachment.regionHeight = texture.height;
|
regionAttachment.regionHeight = frame.height;
|
||||||
regionAttachment.regionOriginalWidth = texture.width;
|
regionAttachment.regionOriginalWidth = texture.width;
|
||||||
regionAttachment.regionOriginalHeight = texture.height;
|
regionAttachment.regionOriginalHeight = texture.height;
|
||||||
return regionAttachment;
|
return regionAttachment;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user