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.
 
 
 

71 line
1.5 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright © 2010—2019 Sam Hocevar <sam@hocevar.net>
  5. //
  6. // Lol Engine is free software. It comes without any warranty, to
  7. // the extent permitted by applicable law. You can redistribute it
  8. // and/or modify it under the terms of the Do What the Fuck You Want
  9. // to Public License, Version 2, as published by the WTFPL Task Force.
  10. // See http://www.wtfpl.net/ for more details.
  11. //
  12. #include <lol/engine-internal.h>
  13. #include <cstdlib>
  14. namespace lol
  15. {
  16. /*
  17. * Public entity class
  18. */
  19. entity::entity()
  20. {
  21. #if !LOL_BUILD_RELEASE
  22. m_tickstate = tickable::state::idle;
  23. #endif
  24. m_gamegroup = tickable::group::game::entity;
  25. m_drawgroup = tickable::group::draw::entity;
  26. /* FIXME: is this a problem? because the object can
  27. * be ticked before the constructor is finished! */
  28. Ticker::Register(this);
  29. }
  30. entity::~entity()
  31. {
  32. #if !LOL_BUILD_RELEASE
  33. if (!has_flags(flags::destroying))
  34. msg::error("entity destructor called directly\n");
  35. #endif
  36. }
  37. std::string entity::GetName() const
  38. {
  39. return "<entity>";
  40. }
  41. void entity::tick_game(float seconds)
  42. {
  43. UNUSED(seconds);
  44. #if !LOL_BUILD_RELEASE
  45. if (m_tickstate != tickable::state::pre_game)
  46. msg::error("invalid entity game tick\n");
  47. m_tickstate = tickable::state::post_game;
  48. #endif
  49. }
  50. void entity::tick_draw(float seconds, Scene &scene)
  51. {
  52. UNUSED(seconds, scene);
  53. #if !LOL_BUILD_RELEASE
  54. if (m_tickstate != tickable::state::pre_draw)
  55. msg::error("invalid entity draw tick\n");
  56. m_tickstate = tickable::state::post_draw;
  57. #endif
  58. }
  59. } /* namespace lol */