mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-10 17:18:44 +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.attachments.AtlasAttachmentLoader;
|
||||
import spine.flash.SingleTextureLoader;
|
||||
import spine.flash.SkeletonAnimationSprite;
|
||||
import spine.flash.SkeletonAnimation;
|
||||
|
||||
[SWF(width = "640", height = "480", frameRate = "60", backgroundColor = "#dddddd")]
|
||||
public class Main extends Sprite {
|
||||
@ -22,7 +22,7 @@ public class Main extends Sprite {
|
||||
[Embed(source = "spineboy.json", mimeType = "application/octet-stream")]
|
||||
static public const SpineboyJson:Class;
|
||||
|
||||
private var skeleton:SkeletonAnimationSprite;
|
||||
private var skeleton:SkeletonAnimation;
|
||||
|
||||
public function Main () {
|
||||
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", "jump", 0.2);
|
||||
|
||||
skeleton = new SkeletonAnimationSprite(skeletonData);
|
||||
skeleton = new SkeletonAnimation(skeletonData);
|
||||
skeleton.setAnimationStateData(stateData);
|
||||
skeleton.x = 320;
|
||||
skeleton.y = 420;
|
||||
|
||||
@ -3,10 +3,10 @@ import spine.AnimationState;
|
||||
import spine.AnimationStateData;
|
||||
import spine.SkeletonData;
|
||||
|
||||
public class SkeletonAnimationSprite extends SkeletonSprite {
|
||||
public class SkeletonAnimation extends SkeletonSprite {
|
||||
public var states:Vector.<AnimationState> = new Vector.<AnimationState>();
|
||||
|
||||
public function SkeletonAnimationSprite (skeletonData:SkeletonData) {
|
||||
public function SkeletonAnimation (skeletonData:SkeletonData) {
|
||||
super(skeletonData);
|
||||
addAnimationState();
|
||||
}
|
||||
@ -10,7 +10,7 @@
|
||||
</excludedEntries>
|
||||
</libraryPathEntry>
|
||||
<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>
|
||||
<sourceAttachmentPath/>
|
||||
</compiler>
|
||||
|
||||
@ -3,10 +3,10 @@ package spine.starling {
|
||||
import spine.AnimationStateData;
|
||||
import spine.SkeletonData;
|
||||
|
||||
public class SkeletonAnimationSprite extends SkeletonSprite {
|
||||
public class SkeletonAnimation extends SkeletonSprite {
|
||||
public var states:Vector.<AnimationState> = new Vector.<AnimationState>();
|
||||
|
||||
public function SkeletonAnimationSprite (skeletonData:SkeletonData) {
|
||||
public function SkeletonAnimation (skeletonData:SkeletonData) {
|
||||
super(skeletonData);
|
||||
addAnimationState();
|
||||
}
|
||||
@ -35,6 +35,7 @@ public class SkeletonSprite extends DisplayObject implements IAnimatable {
|
||||
}
|
||||
|
||||
override public function render (support:RenderSupport, alpha:Number) : void {
|
||||
alpha *= this.alpha * skeleton.a;
|
||||
var drawOrder:Vector.<Slot> = skeleton.drawOrder;
|
||||
for (var i:int = 0, n:int = drawOrder.length; i < n; i++) {
|
||||
var slot:Slot = drawOrder[i];
|
||||
@ -45,11 +46,11 @@ public class SkeletonSprite extends DisplayObject implements IAnimatable {
|
||||
var r:Number = skeleton.r * slot.r;
|
||||
var g:Number = skeleton.g * slot.g;
|
||||
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 vertexData:Vector.<Number> = image.vertexData.rawData;
|
||||
|
||||
|
||||
vertexData[0] = vertices[2];
|
||||
vertexData[1] = vertices[3];
|
||||
vertexData[2] = r;
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
package spine.starling {
|
||||
import flash.geom.Rectangle;
|
||||
|
||||
import spine.Bone;
|
||||
import spine.Skin;
|
||||
import spine.attachments.Attachment;
|
||||
@ -22,11 +24,13 @@ public class StarlingAtlasAttachmentLoader implements AttachmentLoader {
|
||||
if (type == AttachmentType.region) {
|
||||
var regionAttachment:RegionAttachment = new RegionAttachment(name);
|
||||
var texture:Texture = atlas.getTexture(name);
|
||||
var frame:Rectangle = texture.frame;
|
||||
texture = Texture.fromTexture(texture); // Discard frame.
|
||||
regionAttachment.rendererObject = new SkeletonImage(texture);
|
||||
regionAttachment.regionOffsetX = texture.frame.x;
|
||||
regionAttachment.regionOffsetY = texture.frame.y;
|
||||
regionAttachment.regionWidth = texture.width;
|
||||
regionAttachment.regionHeight = texture.height;
|
||||
regionAttachment.regionOffsetX = frame.x;
|
||||
regionAttachment.regionOffsetY = frame.y;
|
||||
regionAttachment.regionWidth = frame.width;
|
||||
regionAttachment.regionHeight = frame.height;
|
||||
regionAttachment.regionOriginalWidth = texture.width;
|
||||
regionAttachment.regionOriginalHeight = texture.height;
|
||||
return regionAttachment;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user