mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +08:00
Changed Atlas constructor to take a path.
This commit is contained in:
parent
6addb86a40
commit
6e7e8c5512
@ -51,7 +51,7 @@ class Atlas: public BaseAtlas {
|
|||||||
public:
|
public:
|
||||||
Atlas (std::ifstream &file);
|
Atlas (std::ifstream &file);
|
||||||
Atlas (std::istream &input);
|
Atlas (std::istream &input);
|
||||||
Atlas (const std::string &text);
|
Atlas (const std::string &path);
|
||||||
Atlas (const char *begin, const char *end);
|
Atlas (const char *begin, const char *end);
|
||||||
|
|
||||||
AtlasRegion* findRegion (const std::string &name);
|
AtlasRegion* findRegion (const std::string &name);
|
||||||
|
|||||||
@ -34,9 +34,7 @@ using namespace spine;
|
|||||||
int main () {
|
int main () {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ifstream atlasFile("../data/spineboy.atlas");
|
Atlas *atlas = new Atlas("../data/spineboy.atlas");
|
||||||
Atlas *atlas = new Atlas(atlasFile);
|
|
||||||
|
|
||||||
SkeletonJson json(atlas);
|
SkeletonJson json(atlas);
|
||||||
SkeletonData *skeletonData = json.readSkeletonDataFile("../data/spineboy-skeleton.json");
|
SkeletonData *skeletonData = json.readSkeletonDataFile("../data/spineboy-skeleton.json");
|
||||||
Animation *animation = json.readAnimationFile("../data/spineboy-walk.json", skeletonData);
|
Animation *animation = json.readAnimationFile("../data/spineboy-walk.json", skeletonData);
|
||||||
|
|||||||
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#include <SFML/Graphics/Texture.hpp>
|
#include <SFML/Graphics/Texture.hpp>
|
||||||
#include <spine-sfml/Atlas.h>
|
#include <spine-sfml/Atlas.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
|
|
||||||
@ -42,8 +44,9 @@ Atlas::Atlas (std::istream &input) {
|
|||||||
load(input);
|
load(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
Atlas::Atlas (const std::string &text) {
|
Atlas::Atlas (const std::string &path) {
|
||||||
load(text);
|
std::ifstream file("../data/spineboy.atlas");
|
||||||
|
load(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
Atlas::Atlas (const char *begin, const char *end) {
|
Atlas::Atlas (const char *begin, const char *end) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user