Animations.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "Animations.h"
  2. namespace gameplay
  3. {
  4. Animations::Animations(void)
  5. {
  6. // There will only be one Animations.
  7. // It requires an ID because it will be stores in the ref table.
  8. setId("__Animations__");
  9. }
  10. Animations::~Animations(void)
  11. {
  12. }
  13. unsigned int Animations::getTypeId(void) const
  14. {
  15. return ANIMATIONS_ID;
  16. }
  17. const char* Animations::getElementName(void) const
  18. {
  19. return "Animations";
  20. }
  21. void Animations::writeBinary(FILE* file)
  22. {
  23. Object::writeBinary(file);
  24. write(_animations.size(), file);
  25. for (std::vector<Animation*>::iterator i = _animations.begin(); i != _animations.end(); i++)
  26. {
  27. (*i)->writeBinary(file);
  28. }
  29. }
  30. void Animations::writeText(FILE* file)
  31. {
  32. fprintElementStart(file);
  33. if (_animations.size() > 0 )
  34. {
  35. for (std::vector<Animation*>::iterator i = _animations.begin(); i != _animations.end(); i++)
  36. {
  37. (*i)->writeText(file);
  38. }
  39. }
  40. fprintElementEnd(file);
  41. }
  42. void Animations::add(Animation* animation)
  43. {
  44. _animations.push_back(animation);
  45. }
  46. }