diff options
author | Chris Xiong <chirs241097@gmail.com> | 2015-10-06 21:28:40 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2015-10-06 21:28:40 +0800 |
commit | 038b31f0158a0018dbf2eceb71026cc4e665faa9 (patch) | |
tree | a373ddab7bc162e477e28a780b0d729660ff8634 /include/smanim.hpp | |
parent | a8077292d5d9118866f7358c11a90c855e1b1b02 (diff) | |
download | SMELT-038b31f0158a0018dbf2eceb71026cc4e665faa9.tar.xz |
Add the SMELT files...
Please, do not laugh too loudly.
Diffstat (limited to 'include/smanim.hpp')
-rw-r--r-- | include/smanim.hpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/include/smanim.hpp b/include/smanim.hpp new file mode 100644 index 0000000..c203961 --- /dev/null +++ b/include/smanim.hpp @@ -0,0 +1,70 @@ +// -*- C++ -*- +/* + * Simple MultimEdia LiTerator(SMELT) + * by Chris Xiong 2015 + * Animation header + * + * WARNING: This library is in development and interfaces would be very + * unstable. + * + */ +#ifndef SMANIM_H +#define SMANIM_H +#include "smelt.hpp" +#include "smentity.hpp" +#include "smdatapack.hpp" +#include <map> +#include <string> + +class smTexInfo +{ +public: + smTexRect rect; + char *name,*path; + SMTEX tex; +}; +class smAnmInfo +{ +public: + smTexInfo frames[256]; + int framedur[256],mode,fc; + char* name; +}; +class smAnmFile +{ +private: + static SMELT *sm; + smDtpFileR anm; + void parseMeta(const char* meta,DWORD size); + std::map<std::string,smTexInfo> tm; + std::map<std::string,smAnmInfo> am; + std::map<std::string,SMTEX> xm; +public: + bool loadAnmFromMemory(const char* ptr,DWORD size); + void close(); + smTexInfo* getTextureInfo(const char* name); + smAnmInfo* getAnimationInfo(const char* name); +}; +class smAnimation2D:public smEntity2D +{ +private: + smAnmInfo ai; + smAnimation2D(); + int cf,mf,r; +public: + smAnimation2D(smAnmInfo a); + void updateAnim(int f=1); + void resetAnim(); +}; +class smAnimation3D:public smEntity3D +{ +private: + smAnmInfo ai; + smAnimation3D(); + int cf,mf,r; +public: + smAnimation3D(smAnmInfo a); + void updateAnim(int f=1); + void resetAnim(); +}; +#endif |