Changed Atlas constructor to take a path.

This commit is contained in:
NathanSweet 2013-03-25 12:12:04 +01:00
parent 6addb86a40
commit 6e7e8c5512
3 changed files with 7 additions and 6 deletions

View File

@ -51,7 +51,7 @@ class Atlas: public BaseAtlas {
public:
Atlas (std::ifstream &file);
Atlas (std::istream &input);
Atlas (const std::string &text);
Atlas (const std::string &path);
Atlas (const char *begin, const char *end);
AtlasRegion* findRegion (const std::string &name);

View File

@ -34,9 +34,7 @@ using namespace spine;
int main () {
try {
ifstream atlasFile("../data/spineboy.atlas");
Atlas *atlas = new Atlas(atlasFile);
Atlas *atlas = new Atlas("../data/spineboy.atlas");
SkeletonJson json(atlas);
SkeletonData *skeletonData = json.readSkeletonDataFile("../data/spineboy-skeleton.json");
Animation *animation = json.readAnimationFile("../data/spineboy-walk.json", skeletonData);

View File

@ -25,6 +25,8 @@
#include <SFML/Graphics/Texture.hpp>
#include <spine-sfml/Atlas.h>
#include <iostream>
#include <fstream>
namespace spine {
@ -42,8 +44,9 @@ Atlas::Atlas (std::istream &input) {
load(input);
}
Atlas::Atlas (const std::string &text) {
load(text);
Atlas::Atlas (const std::string &path) {
std::ifstream file("../data/spineboy.atlas");
load(file);
}
Atlas::Atlas (const char *begin, const char *end) {