@ -124,6 +124,8 @@
|
|||||||
### Love2D
|
### Love2D
|
||||||
|
|
||||||
### Corona
|
### Corona
|
||||||
|
* **Breaking changes**
|
||||||
|
* spine-corona has been renamed to spine-solar2d. Change your `require "spine-corona.spine"` statements to `require "spine-solar2d.spine"`
|
||||||
|
|
||||||
## Typescript/Javascript
|
## Typescript/Javascript
|
||||||
* **Breaking changes**
|
* **Breaking changes**
|
||||||
|
|||||||
@ -118,43 +118,43 @@ cp -f ../mix-and-match/export/mix-and-match.atlas "$ROOT/spine-cocos2dx/example-
|
|||||||
cp -f ../mix-and-match/export/mix-and-match.png "$ROOT/spine-cocos2dx/example-v4/Resources/common/"
|
cp -f ../mix-and-match/export/mix-and-match.png "$ROOT/spine-cocos2dx/example-v4/Resources/common/"
|
||||||
|
|
||||||
|
|
||||||
echo "spine-corona"
|
echo "spine-solar2d"
|
||||||
rm "$ROOT/spine-corona/data/"*
|
rm "$ROOT/spine-solar2d/data/"*
|
||||||
cp -f ../coin/export/coin-pro.json "$ROOT/spine-corona/data"
|
cp -f ../coin/export/coin-pro.json "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../coin/export/coin.atlas "$ROOT/spine-corona/data"
|
cp -f ../coin/export/coin.atlas "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../coin/export/coin.png "$ROOT/spine-corona/data"
|
cp -f ../coin/export/coin.png "$ROOT/spine-solar2d/data"
|
||||||
|
|
||||||
cp -f ../goblins/export/goblins-pro.json "$ROOT/spine-corona/data"
|
cp -f ../goblins/export/goblins-pro.json "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../goblins/export/goblins.atlas "$ROOT/spine-corona/data"
|
cp -f ../goblins/export/goblins.atlas "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../goblins/export/goblins.png "$ROOT/spine-corona/data"
|
cp -f ../goblins/export/goblins.png "$ROOT/spine-solar2d/data"
|
||||||
|
|
||||||
cp -f ../raptor/export/raptor-pro.json "$ROOT/spine-corona/data"
|
cp -f ../raptor/export/raptor-pro.json "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../raptor/export/raptor.atlas "$ROOT/spine-corona/data"
|
cp -f ../raptor/export/raptor.atlas "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../raptor/export/raptor.png "$ROOT/spine-corona/data"
|
cp -f ../raptor/export/raptor.png "$ROOT/spine-solar2d/data"
|
||||||
|
|
||||||
cp -f ../spineboy/export/spineboy-pro.json "$ROOT/spine-corona/data"
|
cp -f ../spineboy/export/spineboy-pro.json "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../spineboy/export/spineboy.atlas "$ROOT/spine-corona/data"
|
cp -f ../spineboy/export/spineboy.atlas "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../spineboy/export/spineboy.png "$ROOT/spine-corona/data"
|
cp -f ../spineboy/export/spineboy.png "$ROOT/spine-solar2d/data"
|
||||||
|
|
||||||
cp -f ../tank/export/tank-pro.json "$ROOT/spine-corona/data"
|
cp -f ../tank/export/tank-pro.json "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../tank/export/tank.atlas "$ROOT/spine-corona/data"
|
cp -f ../tank/export/tank.atlas "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../tank/export/tank.png "$ROOT/spine-corona/data"
|
cp -f ../tank/export/tank.png "$ROOT/spine-solar2d/data"
|
||||||
|
|
||||||
cp -f ../vine/export/vine-pro.json "$ROOT/spine-corona/data"
|
cp -f ../vine/export/vine-pro.json "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../vine/export/vine.atlas "$ROOT/spine-corona/data"
|
cp -f ../vine/export/vine.atlas "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../vine/export/vine.png "$ROOT/spine-corona/data"
|
cp -f ../vine/export/vine.png "$ROOT/spine-solar2d/data"
|
||||||
|
|
||||||
cp -f ../stretchyman/export/stretchyman-pro.json "$ROOT/spine-corona/data"
|
cp -f ../stretchyman/export/stretchyman-pro.json "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../stretchyman/export/stretchyman.atlas "$ROOT/spine-corona/data"
|
cp -f ../stretchyman/export/stretchyman.atlas "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../stretchyman/export/stretchyman.png "$ROOT/spine-corona/data"
|
cp -f ../stretchyman/export/stretchyman.png "$ROOT/spine-solar2d/data"
|
||||||
|
|
||||||
cp -f ../owl/export/owl-pro.json "$ROOT/spine-corona/data"
|
cp -f ../owl/export/owl-pro.json "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../owl/export/owl.atlas "$ROOT/spine-corona/data"
|
cp -f ../owl/export/owl.atlas "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../owl/export/owl.png "$ROOT/spine-corona/data"
|
cp -f ../owl/export/owl.png "$ROOT/spine-solar2d/data"
|
||||||
|
|
||||||
cp -f ../mix-and-match/export/mix-and-match-pro.json "$ROOT/spine-corona/data"
|
cp -f ../mix-and-match/export/mix-and-match-pro.json "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../mix-and-match/export/mix-and-match.atlas "$ROOT/spine-corona/data"
|
cp -f ../mix-and-match/export/mix-and-match.atlas "$ROOT/spine-solar2d/data"
|
||||||
cp -f ../mix-and-match/export/mix-and-match.png "$ROOT/spine-corona/data"
|
cp -f ../mix-and-match/export/mix-and-match.png "$ROOT/spine-solar2d/data"
|
||||||
|
|
||||||
echo "spine-love"
|
echo "spine-love"
|
||||||
rm "$ROOT/spine-love/data/"*
|
rm "$ROOT/spine-love/data/"*
|
||||||
|
|||||||
@ -1,79 +0,0 @@
|
|||||||
require("mobdebug").start()
|
|
||||||
|
|
||||||
local spine = require "spine-corona.spine"
|
|
||||||
|
|
||||||
function loadSkeleton(atlasFile, jsonFile, x, y, scale, animation, skin)
|
|
||||||
-- to load an atlas, we need to define a function that returns
|
|
||||||
-- a Corona paint object. This allows you to resolve images
|
|
||||||
-- however you see fit
|
|
||||||
local imageLoader = function (path)
|
|
||||||
local paint = { type = "image", filename = "data/" .. path }
|
|
||||||
return paint
|
|
||||||
end
|
|
||||||
|
|
||||||
-- load the atlas
|
|
||||||
local atlas = spine.TextureAtlas.new(spine.utils.readFile("data/" .. atlasFile), imageLoader)
|
|
||||||
|
|
||||||
-- load the JSON and create a Skeleton from it
|
|
||||||
local json = spine.SkeletonJson.new(spine.AtlasAttachmentLoader.new(atlas))
|
|
||||||
json.scale = scale
|
|
||||||
local skeletonData = json:readSkeletonDataFile("data/" .. jsonFile)
|
|
||||||
local skeleton = spine.Skeleton.new(skeletonData)
|
|
||||||
skeleton.scaleY = -1 -- Corona's coordinate system has its y-axis point downwards
|
|
||||||
skeleton.group.x = x
|
|
||||||
skeleton.group.y = y
|
|
||||||
|
|
||||||
-- Set the skin if we got one
|
|
||||||
if skin then skeleton:setSkin(skin) end
|
|
||||||
|
|
||||||
-- create an animation state object to apply animations to the skeleton
|
|
||||||
local animationStateData = spine.AnimationStateData.new(skeletonData)
|
|
||||||
animationStateData.defaultMix = 0.5
|
|
||||||
local animationState = spine.AnimationState.new(animationStateData)
|
|
||||||
|
|
||||||
-- set a name on the group of the skeleton so we can find it during debugging
|
|
||||||
skeleton.group.name = jsonFile
|
|
||||||
|
|
||||||
-- set some event callbacks
|
|
||||||
animationState.onStart = function (entry)
|
|
||||||
print(entry.trackIndex.." start: "..entry.animation.name)
|
|
||||||
end
|
|
||||||
animationState.onInterrupt = function (entry)
|
|
||||||
print(entry.trackIndex.." interrupt: "..entry.animation.name)
|
|
||||||
end
|
|
||||||
animationState.onEnd = function (entry)
|
|
||||||
print(entry.trackIndex.." end: "..entry.animation.name)
|
|
||||||
end
|
|
||||||
animationState.onComplete = function (entry)
|
|
||||||
print(entry.trackIndex.." complete: "..entry.animation.name)
|
|
||||||
end
|
|
||||||
animationState.onDispose = function (entry)
|
|
||||||
print(entry.trackIndex.." dispose: "..entry.animation.name)
|
|
||||||
end
|
|
||||||
animationState.onEvent = function (entry, event)
|
|
||||||
print(entry.trackIndex.." event: "..entry.animation.name..", "..event.data.name..", "..event.intValue..", "..event.floatValue..", '"..(event.stringValue or "").."'" .. ", " .. event.volume .. ", " .. event.balance)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- return the skeleton an animation state
|
|
||||||
return { skeleton = skeleton, state = animationState }
|
|
||||||
end
|
|
||||||
|
|
||||||
local lastTime = 0
|
|
||||||
local result = loadSkeleton("spineboy.atlas", "spineboy-pro.json", 240, 300, 0.4, "walk")
|
|
||||||
local skeleton = result.skeleton;
|
|
||||||
local state = result.state;
|
|
||||||
|
|
||||||
state:setAnimationByName(0, "idle", true)
|
|
||||||
state:setAnimationByName(5, "shoot", true, 0)
|
|
||||||
|
|
||||||
display.setDefault("background", 0.2, 0.2, 0.2, 1)
|
|
||||||
|
|
||||||
Runtime:addEventListener("enterFrame", function (event)
|
|
||||||
local currentTime = event.time / 1000
|
|
||||||
local delta = currentTime - lastTime
|
|
||||||
lastTime = currentTime
|
|
||||||
|
|
||||||
state:update(delta)
|
|
||||||
state:apply(skeleton)
|
|
||||||
skeleton:updateWorldTransform()
|
|
||||||
end)
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
# spine-corona
|
# spine-solar2d
|
||||||
|
|
||||||
The spine-corona runtime provides functionality to load, manipulate and render [Spine](http://esotericsoftware.com) skeletal animation data using [Corona](http://coronalabs.com/products/corona-sdk/). spine-corona is based on [spine-lua](../spine-lua).
|
The spine-solar2d runtime provides functionality to load, manipulate and render [Spine](http://esotericsoftware.com) skeletal animation data using [Solar2D](https://solar2d.com/) (previously Corona). spine-solar2d is based on [spine-lua](../spine-lua).
|
||||||
|
|
||||||
## Licensing
|
## Licensing
|
||||||
|
|
||||||
@ -14,18 +14,18 @@ For the official legal terms governing the Spine Runtimes, please read the [Spin
|
|||||||
|
|
||||||
## Spine version
|
## Spine version
|
||||||
|
|
||||||
spine-corona works with data exported from Spine 3.9.xx.
|
spine-solar2d works with data exported from Spine 3.9.xx.
|
||||||
|
|
||||||
spine-corona supports all Spine features.
|
spine-solar2d supports all Spine features.
|
||||||
|
|
||||||
spine-corona does not yet support loading the binary format.
|
spine-solar2d does not yet support loading the binary format.
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
1. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it as a zip via the download button above.
|
1. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it as a zip via the download button above.
|
||||||
2. Copy the `spine-lua/spine-lua` folder to `spine-corona`.
|
2. Copy the `spine-lua/spine-lua` folder to `spine-solar2d`.
|
||||||
3. Run the `main.lua` file using Corona. Tap/click to switch between skeletons
|
3. Run the `main.lua` file using Solar2D. Tap/click to switch between skeletons
|
||||||
|
|
||||||
Alternatively, the `spine-lua` and `spine-corona/spine-corona` directories can be copied into your project. Note that the spine-corona `require` statements use `spine-lua.Xxx`, so the spine-lua files must be in a `spine-lua` directory in your project.
|
Alternatively, the `spine-lua` and `spine-solar2d/spine-solar2d` directories can be copied into your project. Note that the spine-solar2d `require` statements use `spine-lua.Xxx`, so the spine-lua files must be in a `spine-lua` directory in your project.
|
||||||
|
|
||||||
When using the `EmmyLua` plugin for IntelliJ IDEA, create a launch configuration pointing at the `Corona Simulator` executable (e.g. ` /Applications/Corona/Corona Simulator.app/Contents/MacOS/Corona Simulator` on macOS), set the working directory to `spine-corona`, and set the parameters to `main.lua`.
|
When using the `EmmyLua` plugin for IntelliJ IDEA, create a launch configuration pointing at the `Corona Simulator` executable (e.g. ` /Applications/Corona/Corona Simulator.app/Contents/MacOS/Corona Simulator` on macOS), set the working directory to `spine-solar2d`, and set the parameters to `main.lua`.
|
||||||
|
Before Width: | Height: | Size: 251 KiB After Width: | Height: | Size: 251 KiB |
|
Before Width: | Height: | Size: 161 KiB After Width: | Height: | Size: 161 KiB |
|
Before Width: | Height: | Size: 350 KiB After Width: | Height: | Size: 350 KiB |
|
Before Width: | Height: | Size: 314 KiB After Width: | Height: | Size: 314 KiB |
|
Before Width: | Height: | Size: 412 KiB After Width: | Height: | Size: 412 KiB |
|
Before Width: | Height: | Size: 243 KiB After Width: | Height: | Size: 243 KiB |
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 437 KiB After Width: | Height: | Size: 437 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
require("mobdebug").start()
|
require("mobdebug").start()
|
||||||
|
|
||||||
local spine = require "spine-corona.spine"
|
local spine = require "spine-solar2d.spine"
|
||||||
|
|
||||||
local skeletons = {}
|
local skeletons = {}
|
||||||
local activeSkeleton = 1
|
local activeSkeleton = 1
|
||||||