-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from cursedcoder/update-docs
Reorganize documentation and update old stuff
- Loading branch information
Showing
14 changed files
with
192 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
### How to change atlas file extension (I hate IIS webserver) | ||
|
||
```js | ||
var spineLoaderOptions = { metadata: { spineAtlasSuffix: '.txt' } }; | ||
PIXI.loader | ||
.add('pixie', '_assets/spine/Pixie.json', spineLoaderOptions) | ||
.load(onAssetsLoaded); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
### Changing Skins | ||
Once skins are defined in Spine, it's possible to change them in runtime. According to the Spine libraries: | ||
>If skin is already set, new skin can change only slots attached in old skin. | ||
So if a skin has been set and another skin is to be set, it may result in the newer skin not showing. To workaround this issue, set the skin to null and then set the skin like so: | ||
|
||
```js | ||
var spineCharacter = new PIXI.spine.Spine(resources.boy.spineData); | ||
var skeleton = spineCharacter.skeleton; | ||
|
||
function setSkinByName(skinName) { | ||
skeleton.setSkin(null); | ||
skeleton.setSkinByName(skinName); | ||
} | ||
|
||
setSkinByName('lighter'); | ||
|
||
``` | ||
If the skin is changed whilst the spineCharacter is animating, there may be a problem with the draw order of some assets. This will resolve when the animation finishes it's loop or the animation is restarted. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
### How to use compressed textures | ||
|
||
```js | ||
PIXI.loader.before(PIXI.compressedTextures.extensionChooser(["@2x.atlas", ".dds"])); | ||
var options = { metadata: { spineMetadata: { choice: ["@.5x.atlas", "@2x.atlas"] }, imageMetadata: { choice: [".dds", ".pvr"] } } }; | ||
|
||
PIXI.loader | ||
.add('spineCharacter', 'spine-data-1/HERO.json', options) | ||
.load(function (loader, resources) { | ||
var animation = new PIXI.spine.Spine(resources.spineCharacter.spineData); | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
### Changing the texture the direct way (hacks) | ||
|
||
```js | ||
//let 'spine' be Spine object | ||
var spine = new PIXI.spine.Spine(loader.resources['spineBoy'].data); | ||
//let myTexture be the texture you are assigning. it can be something from the spritesheet | ||
var myTexture = loader.resources['newRegionTexture'].texture; | ||
|
||
spine.hackTextureBySlotName('head', myTexture); | ||
|
||
//Region attachments are tricky: they must have width and height, specify it if your texture differs from old one | ||
spine.hackTextureBySlotName('arm', myTexture, { width: 100, height : 100 }); | ||
//If you want texture have its natural size, pass it. pixiV3 - texture.frame, pixiV4 - texture.orig | ||
spine.hackTextureBySlotIndex(7, myTexture, texture.orig || texture.frame); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
pixi-spine docs | ||
=============== | ||
|
||
1. [How to change atlas file extension (I hate IIS webserver)](change_atlas_extension.md) | ||
2. [Changing Spine Skins](change_skin.md) | ||
3. [How to use compressed textures](compressed_textures.md) | ||
4. [How to make dynamic texture atlas (without .atlas file)](dynamic_texture_atlas.md) | ||
5. [Changing the texture the direct way (hacks)](hack_texture.md) | ||
6. [How to use pre-loaded json and atlas files](preloaded_json.md) | ||
7. [How to use spine events](spine_events.md) | ||
8. [How to choose resolution](texture_and_sprite_resolution.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
### How to use pre-loaded json and atlas files | ||
|
||
```js | ||
var rawSkeletonData = JSON.parse("$jsondata"); //your skeleton.json file here | ||
var rawAtlasData = "$atlasdata"; //your atlas file | ||
|
||
var spineAtlas = new PIXI.spine.core.TextureAtlas(rawAtlasData, function(line, callback) { | ||
// pass the image here. | ||
callback(PIXI.BaseTexture.fromImage(line)); | ||
}); // specify path, image.png will be added automatically | ||
|
||
var spineAtlasLoader = new PIXI.spine.core.AtlasAttachmentLoader(spineAtlas) | ||
var spineJsonParser = new PIXI.spine.core.SkeletonJson(spineAtlasLoader); | ||
var spineData = spineJsonParser.readSkeletonData(rawSkeletonData); | ||
|
||
// now we can create spine instance | ||
var spine = new PIXI.spine.Spine(spineData); | ||
``` |
Oops, something went wrong.