You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

64 lines
1.0 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://sam.zoy.org/projects/COPYING.WTFPL for more details.
  9. //
  10. #if defined HAVE_CONFIG_H
  11. # include "config.h"
  12. #endif
  13. #include "core.h"
  14. namespace lol
  15. {
  16. /*
  17. * Sprite implementation class
  18. */
  19. class SpriteData
  20. {
  21. friend class Sprite;
  22. private:
  23. TileSet *tileset;
  24. int id;
  25. };
  26. /*
  27. * Public Sprite class
  28. */
  29. Sprite::Sprite(TileSet *tileset, int id)
  30. : data(new SpriteData())
  31. {
  32. data->tileset = tileset;
  33. data->id = id;
  34. }
  35. void Sprite::TickGame(float seconds)
  36. {
  37. Entity::TickGame(seconds);
  38. }
  39. void Sprite::TickDraw(float seconds)
  40. {
  41. Entity::TickDraw(seconds);
  42. Scene::GetDefault()->AddTile(data->tileset, data->id, m_position,
  43. 0, vec2(1.0f));
  44. }
  45. Sprite::~Sprite()
  46. {
  47. delete data;
  48. }
  49. } /* namespace lol */