From 6e7e8c551281374a42f9465ea44e3fbf03f0a5c0 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Mon, 25 Mar 2013 12:12:04 +0100 Subject: [PATCH] Changed Atlas constructor to take a path. --- spine-sfml/include/spine-sfml/Atlas.h | 2 +- spine-sfml/src/main.cpp | 4 +--- spine-sfml/src/spine-sfml/Atlas.cpp | 7 +++++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/spine-sfml/include/spine-sfml/Atlas.h b/spine-sfml/include/spine-sfml/Atlas.h index c704ac4ed..688476a10 100644 --- a/spine-sfml/include/spine-sfml/Atlas.h +++ b/spine-sfml/include/spine-sfml/Atlas.h @@ -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); diff --git a/spine-sfml/src/main.cpp b/spine-sfml/src/main.cpp index ca97d8ab7..587113812 100644 --- a/spine-sfml/src/main.cpp +++ b/spine-sfml/src/main.cpp @@ -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); diff --git a/spine-sfml/src/spine-sfml/Atlas.cpp b/spine-sfml/src/spine-sfml/Atlas.cpp index 660594343..4ecf431fc 100644 --- a/spine-sfml/src/spine-sfml/Atlas.cpp +++ b/spine-sfml/src/spine-sfml/Atlas.cpp @@ -25,6 +25,8 @@ #include #include +#include +#include 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) {