25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

73 lines
1.3 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2011 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 <cstdlib>
  14. #include "core.h"
  15. namespace lol
  16. {
  17. /*
  18. * Public Entity class
  19. */
  20. Entity::Entity() :
  21. gamenext(0),
  22. drawnext(0),
  23. ref(0),
  24. destroy(0)
  25. {
  26. #if !LOL_RELEASE
  27. state = STATE_IDLE;
  28. #endif
  29. gamegroup = GAMEGROUP_DEFAULT;
  30. drawgroup = DRAWGROUP_DEFAULT;
  31. Ticker::Register(this);
  32. }
  33. Entity::~Entity()
  34. {
  35. #if !LOL_RELEASE
  36. if (!destroy)
  37. Log::Error("entity destructor called directly\n");
  38. #endif
  39. }
  40. char const *Entity::GetName()
  41. {
  42. return "<entity>";
  43. }
  44. void Entity::TickGame(float deltams)
  45. {
  46. #if !LOL_RELEASE
  47. if (state != STATE_PRETICK_GAME)
  48. Log::Error("invalid entity game tick\n");
  49. state = STATE_POSTTICK_GAME;
  50. #endif
  51. }
  52. void Entity::TickDraw(float deltams)
  53. {
  54. #if !LOL_RELEASE
  55. if (state != STATE_PRETICK_DRAW)
  56. Log::Error("invalid entity draw tick\n");
  57. state = STATE_POSTTICK_DRAW;
  58. #endif
  59. }
  60. } /* namespace lol */