您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

86 行
1.6 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2013 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://www.wtfpl.net/ 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. m_gamenext(0),
  22. m_drawnext(0),
  23. m_ref(0),
  24. m_destroy(0)
  25. {
  26. #if !LOL_RELEASE
  27. m_tickstate = STATE_IDLE;
  28. #endif
  29. m_gamegroup = GAMEGROUP_DEFAULT;
  30. m_drawgroup = DRAWGROUP_DEFAULT;
  31. Ticker::Register(this);
  32. }
  33. Entity::~Entity()
  34. {
  35. #if !LOL_RELEASE
  36. if (!m_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 seconds)
  45. {
  46. (void)seconds;
  47. #if !LOL_RELEASE
  48. if (m_tickstate != STATE_PRETICK_GAME)
  49. Log::Error("invalid entity game tick\n");
  50. m_tickstate = STATE_POSTTICK_GAME;
  51. #endif
  52. }
  53. void Entity::TickDraw(float seconds)
  54. {
  55. (void)seconds;
  56. #if !LOL_RELEASE
  57. if (m_tickstate != STATE_PRETICK_DRAW)
  58. Log::Error("invalid entity draw tick\n");
  59. m_tickstate = STATE_POSTTICK_DRAW;
  60. #endif
  61. }
  62. void Entity::SetState(uint32_t state)
  63. {
  64. Ticker::SetState(this, state);
  65. }
  66. void Entity::SetStateWhenMatch(uint32_t state,
  67. Entity *other_entity, uint32_t other_state)
  68. {
  69. Ticker::SetStateWhenMatch(this, state, other_entity, other_state);
  70. }
  71. } /* namespace lol */