Skip to content

Commit

Permalink
Update README.mds, preprare spine-flutter for publication
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Apr 16, 2024
1 parent 5e34031 commit 072c2c0
Show file tree
Hide file tree
Showing 20 changed files with 212 additions and 128 deletions.
2 changes: 1 addition & 1 deletion examples/export/export.sh
Expand Up @@ -19,7 +19,7 @@ fi
echo "Spine exe: $SPINE_EXE"

if [ "$#" -eq 0 ]; then
echo "Enter the Spine editor version to use for the export (eg 4.1.xx):"
echo "Enter the Spine editor version to use for the export (eg 4.2.xx):"
read version
else
version=${1%/}
Expand Down
3 changes: 2 additions & 1 deletion spine-c/README.md
Expand Up @@ -14,7 +14,7 @@ For the official legal terms governing the Spine Runtimes, please read the [Spin

## Spine version

spine-c works with data exported from Spine 4.1.xx.
spine-c works with data exported from Spine 4.2.xx.

spine-c supports all Spine features.

Expand All @@ -26,6 +26,7 @@ spine-c supports all Spine features.
If `SPINE_SHORT_NAMES` is defined, the `sp` prefix for all structs and functions is optional. Only use this if the spine-c names won't cause a conflict.

## Usage

### [Please see the spine-c guide for full documentation](http://esotericsoftware.com/spine-c)

## Extension
Expand Down
37 changes: 20 additions & 17 deletions spine-cocos2dx/README.md
Expand Up @@ -14,40 +14,40 @@ For the official legal terms governing the Spine Runtimes, please read the [Spin

## Spine version

spine-cocos2dx works with data exported from Spine 4.1.xx.
spine-cocos2dx works with data exported from Spine 4.2.xx.

spine-cocos2dx supports all Spine features.

## Setup

The setup for cocos2d-x differs from most other Spine Runtimes because the cocos2d-x distribution includes a copy of the Spine Runtime files. This is not ideal because these files may be old and fail to work with the latest Spine editor. Also it means if cocos2d-x is updated, you may get newer Spine Runtime files which can break your application if you are not using the latest Spine editor. For these reasons, we have requested cocos2d-x to cease distributing the Spine Runtime files, but they continue to do so. The following instructions allow you to use the official Spine cocos2d-x runtime with your cocos2d-x project.
The setup for cocos2d-x differs from most other Spine Runtimes because the cocos2d-x distribution includes a copy of the Spine Runtime files. This is not ideal because these files may be old and fail to work with the latest Spine editor. Also it means if cocos2d-x is updated, you may get newer Spine Runtime files which can break your application if you are not using the latest Spine editor. For these reasons, we have requested cocos2d-x to cease distributing the Spine Runtime files, but they continue to do so. The following instructions allow you to use the official Spine cocos2d-x runtime with your cocos2d-x project.

spine-cocos2dx works with both Cocos2d-x v3 and v4. The setup process is identical in both cases. The preferred way to integrate spine-cocos2dx into your Cocos2d-x project is to use the [Cocos2d-x CMake build system].


1. [Create a new C++ cocos2d-x project](https://docs.cocos2d-x.org/cocos2d-x/v4/en/editors_and_tools/cocosCLTool.html). Let's assume you created your project in a folder `/path/to/MyGame/` somewhere on your disk.
2. Download the Spine Runtimes source using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above. Let's assume you cloned the Spine Runtimes to a folder `/path/to/spine-runtimes/` somewhere on your disk.
3. Open `MyGame/CMakeLists.txt` in a text editor and modify it as follows:
* After the line `project(${APP_NAME})` add the following line:
```
include(/path/to/spine-runtimes/spine-cocos2dx/spine-cocos2dx.cmake)
```
* Before the line `target_link_libraries(${APP_NAME} cocos2d)`add the following line:
```
target_link_libraries(${APP_NAME} spine-cpp spine-cocos2dx)
```
- After the line `project(${APP_NAME})` add the following line:
```
include(/path/to/spine-runtimes/spine-cocos2dx/spine-cocos2dx.cmake)
```
- Before the line `target_link_libraries(${APP_NAME} cocos2d)`add the following line:
```
target_link_libraries(${APP_NAME} spine-cpp spine-cocos2dx)
```
4. [Proceed with generating IDE files via CMake](https://docs.cocos2d-x.org/cocos2d-x/v4/en/installation/CMake-Guide.html) and build and run your project.

For reference, have a look at our spine-cocos2dx example project in this repository described below.

## Example

The spine-cocos2dx example works on Windows, Linux, macOS, iOS, Linux, and Android, for both cocos2d-x v3 and v4.

Please [install the reprequisit software](https://docs.cocos2d-x.org/cocos2d-x/v4/en/installation/prerequisites.html) as per the Cocos2d-x documentation. Ensure that the following programs are in your `PATH` environment variable and thus executable from the command line:

* `git`
* `cmake`
* `python`
- `git`
- `cmake`
- `python`

Before you can compile and run the example project for a specific target platform, you need to clone the [Cocos2d-x repository](https://github.com/cocos2d/cocos2d-x) to `spine-runtimes/spine-cocos2dx/example/cocos2d` and download the dependencies:

Expand All @@ -64,6 +64,7 @@ python cocos2d/download-deps.py -r yes
You can now use CMake to create IDE projects for the target platform you want to compile and run the example on.

### macOS

Execute the following on the command line:

```
Expand All @@ -77,6 +78,7 @@ This will generate an Xcode project in `build-macos/spine-cocos2dx-example.xcode
> **NOTE:** Passing `-DCMAKE_OSX_ARCHITECTURES=x86_64` to CMake is currently required, as Cocos2d-X only provides prebuilt x86_64 binaries for its external dependencies.
### iOS

Execute the following on the command line:

```
Expand All @@ -88,9 +90,11 @@ open build-ios/spine-cocos2dx-example.xcodeproj
This will generate an Xcode project in `build-ios/spine-cocos2dx-example.xcodeproj` and open it in Xcode. To build and run the example, select the `spine-cocos2dx-example` scheme and select a device or simulator to build for and run on. Finally, press `CMD + R` to build and run the example.

### Android

Open the project in `proj.android` in Android Studio. Make sure you have NDK version `24.0.8215888` installed via the SDK Manager. Alternatively, you can set the `ndkVersion` property in `proj.android/app/build.gradle` to the NDK version you have installed locally.

### Windows

Execute the following on the command line:

```
Expand All @@ -103,6 +107,5 @@ You can then open the file `build-win/spine-cocos2dx-example.sln` with Visual St

## Notes

* Images are premultiplied by cocos2d-x, so the Spine atlas images should *not* use premultiplied alpha.
* Two color tinting needs to be enabled on a per-skeleton basis. Call `SkeletonRenderer::setTwoColorTine(true)` or `SkeletonAnimation::setTwoColorTint(true)` after you created the skeleton instance. Note that two color tinting requires a custom shader and vertex format. Skeletons rendered with two color tinting can therefore not be batched with single color tinted skeletons or other 2D cocos2d-x elements like sprites. However, two-color tinted skeletons will be batched if possible when rendered after one another. Attaching a child to a two color tinted skeleton will also break the batch.

- Images are premultiplied by cocos2d-x, so the Spine atlas images should _not_ use premultiplied alpha.
- Two color tinting needs to be enabled on a per-skeleton basis. Call `SkeletonRenderer::setTwoColorTine(true)` or `SkeletonAnimation::setTwoColorTint(true)` after you created the skeleton instance. Note that two color tinting requires a custom shader and vertex format. Skeletons rendered with two color tinting can therefore not be batched with single color tinted skeletons or other 2D cocos2d-x elements like sprites. However, two-color tinted skeletons will be batched if possible when rendered after one another. Attaching a child to a two color tinted skeleton will also break the batch.
2 changes: 1 addition & 1 deletion spine-cpp/README.md
Expand Up @@ -14,7 +14,7 @@ For the official legal terms governing the Spine Runtimes, please read the [Spin

## Spine version

spine-cpp works with data exported from spine 4.1.xx.
spine-cpp works with data exported from spine 4.2.xx.

spine-cpp supports all spine features.

Expand Down
2 changes: 1 addition & 1 deletion spine-csharp/README.md
Expand Up @@ -14,7 +14,7 @@ For the official legal terms governing the Spine Runtimes, please read the [Spin

## Spine version

spine-csharp works with data exported from Spine 4.1.xx.
spine-csharp works with data exported from Spine 4.2.xx.

spine-csharp supports all Spine features.

Expand Down
3 changes: 3 additions & 0 deletions spine-flutter/CHANGELOG.md
@@ -1,3 +1,6 @@
# 4.2.23
- Physics support

# 4.2.22

- Fix multiply blend mode, see https://esotericsoftware.com/forum/d/25369-spine-flutter-slot%E6%B7%B7%E5%90%88%E6%A8%A1%E5%BC%8F%E5%90%8Ealpha%E4%B8%A2%E5%A4%B1/2
Expand Down
2 changes: 1 addition & 1 deletion spine-flutter/example/pubspec.lock
Expand Up @@ -169,7 +169,7 @@ packages:
path: ".."
relative: true
source: path
version: "4.1.14"
version: "4.2.23"
string_scanner:
dependency: transitive
description:
Expand Down

0 comments on commit 072c2c0

Please sign in to comment.