mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Updated Readme.md
This commit is contained in:
parent
4d5295055d
commit
033a1eeb2c
@ -17,6 +17,60 @@ The Spine Runtimes are developed with the intent to be used with data exported f
|
||||
|
||||
Alternatively, the contents of the `spine-c/src`, `spine-c/include` and `spine-cocos2dx/3/src` directories can be copied into your project. Be sure your header search path will find the contents of the `spine-c/include` and `spine-cocos2dx/3.1/src` directories. Note that the includes use `spine/Xxx.h`, so the `spine` directory cannot be omitted when copying the files.
|
||||
|
||||
## Setup for Cocos Studio Users (cocos2d-x-3.1)
|
||||
1. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it [as a zip](https://github.com/EsotericSoftware/spine-runtimes/archive/master.zip).
|
||||
- Extract them somewhere you can find them. You will only need `spine-c` and `spine-cocos2dx`.
|
||||
1. Download and install Cocos: http://www.cocos2d-x.org/download
|
||||
- (2016 March 4) Downloading and installing Cocos Studio and cocos2d-x-3.1 includes a Spine runtime in their source files. For instance, if the default install folder is `C:\Cocos\`, you will find an existing spine-c and spine-cocos2dx runtime inside `C:\Cocos\Cocos2d-x\cocos2d-x-3.10\cocos\editor-support\spine`.
|
||||
- Replace the contents of that folder with the files from the following Spine runtime folders:
|
||||
- `spine-c/src/spine`
|
||||
- `spine-c/include/spine`
|
||||
- `spine-cocos2dx/3/src/spine`
|
||||
- Since this is the shared version of the runtime Cocos Studio uses for all projects created through it, updating the Spine runtime here also updates the Spine runtime of all those projects.
|
||||
|
||||
### Examples
|
||||
1. The `spine-cocos2dx/3/` runtime folder contains a folder named `example`.
|
||||
- Copy the files in `spine-cocos2dx/3/example/Classes` folder (except `AppDelegate.cpp`, `AppDelegate.h` and `AppMacros.h` into the `Classes` folder of your Cocos Studio project.)
|
||||
1. Add these files into your C++ Solution. (through your IDE, Visual Studio or Eclipse, etc...)
|
||||
2. If this is a newly created project, edit the `AppDelegate.cpp`. For this example, we will use RaptorExample.
|
||||
1. Add `#include "RaptorExample.h"` to the includes near the top of the file.
|
||||
2. Look for the `bool AppDelegate::applicationDidFinishLaunching()` method and replace it with this. Notice the line where it defines the scene `auto scene = RaptorExample::scene()`:
|
||||
|
||||
```cpp
|
||||
bool AppDelegate::applicationDidFinishLaunching() {
|
||||
// initialize director
|
||||
auto director = Director::getInstance();
|
||||
auto glview = director->getOpenGLView();
|
||||
if(!glview) {
|
||||
glview = GLViewImpl::createWithRect("Spine Test", Rect(0, 0, 960, 640));
|
||||
director->setOpenGLView(glview);
|
||||
}
|
||||
|
||||
director->getOpenGLView()->setDesignResolutionSize(960, 640, ResolutionPolicy::SHOW_ALL);
|
||||
|
||||
// turn on display FPS
|
||||
director->setDisplayStats(true);
|
||||
|
||||
// set FPS. the default value is 1.0/60 if you don't call this
|
||||
director->setAnimationInterval(1.0f / 60);
|
||||
|
||||
FileUtils::getInstance()->addSearchPath("res");
|
||||
|
||||
// create a scene. it's an autorelease object
|
||||
auto scene = RaptorExample::scene();
|
||||
|
||||
// run
|
||||
director->runWithScene(scene);
|
||||
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
You can do the same with `GoblinsExample` and `SpineboyExample`.
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Images are premultiplied by cocos2d-x, so the Spine atlas images should *not* use premultiplied alpha.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user