From ea17cf0f8ca0b7e756e91cc297a152b0e713fbcd Mon Sep 17 00:00:00 2001 From: Tegmine Date: Sun, 4 Mar 2012 14:40:58 -0600 Subject: [PATCH] Added != to Animation. --- Animation.cpp | 8 +++++++- Animation.h | 28 ++++++++++++++++++---------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Animation.cpp b/Animation.cpp index 039a4de..44dd9a3 100644 --- a/Animation.cpp +++ b/Animation.cpp @@ -12,6 +12,11 @@ #include using namespace std; +Animation::Animation():mName() +{ + mBuilt = false; +} + Animation::Animation(std::string animFile):mName(animFile) { loadAnimation(animFile); @@ -28,7 +33,9 @@ int Animation::loadAnimation(std::string animFile) string buffer,file; int transparency[3]; int pause; + int count=0; animFile="ArtAssets/Sprites/"+animFile; + //file ifstream fin(animFile.c_str()); @@ -38,7 +45,6 @@ int Animation::loadAnimation(std::string animFile) return -1; } - int count=0; while(getline(fin,buffer)) { if(buffer[0] != '#' && buffer[0] != '\r' && buffer[0] != '\0' && buffer[0] != '\n' && buffer.length() != 0) diff --git a/Animation.h b/Animation.h index 9afe2de..5474519 100644 --- a/Animation.h +++ b/Animation.h @@ -8,26 +8,34 @@ using std::vector; /** - An Animation +An Animation - This class is tasked with the following: - - loading sets of images into an animation set. +This class is tasked with the following: +- loading sets of images into an animation set. */ class Animation { - public: +public: + //variables + int mBuilt,/**< Using as a bool */ + mNumFrames,/**< Number of frames in this Animation */ + mW,/**< Animation's current width */ + mH;/**< The animation's current Height */ + std::vector Frames; + std::string mName;//add name to anim file + SpriteFrame *mFrames;/**< Pointer to the current animation. As an array of SpriteFrames */ + + //Constructors + Animation(); Animation(std::string animFile); Animation(std::string animFile, string name); + + //Methods int loadAnimation(std::string animFile);/**< Loads the Animations from a file in the specified format. */ - SpriteFrame *mFrames;/**< Pointer to the current animation. As an array of SpriteFrames */ - int mBuilt,/**< Using as a bool */ - mNumFrames,/**< Number of frames in this Animation */ - mW,/**< Animation's current width */ - mH;/**< The animation's current Height */ bool operator==(Animation a){return mName==a.mName;} - std::string mName;//add name to anim file + bool operator!=(Animation a){return mName!=a.mName;} }; #endif -- 2.11.0