Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

89 Zeilen
1.9 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. //
  11. // The Entity class
  12. // ---------------
  13. // Entities are objects that can be ticked by the game loop and/or the render
  14. // loop. Entities are implemented as one or several linked lists. See the
  15. // Ticker class for the ticking logic and the linked list implementation.
  16. //
  17. #if !defined __DH_ENTITY_H__
  18. #define __DH_ENTITY_H__
  19. #include <stdint.h>
  20. namespace lol
  21. {
  22. class Entity
  23. {
  24. friend class Ticker;
  25. friend class TickerData;
  26. friend class Dict;
  27. protected:
  28. Entity();
  29. virtual ~Entity();
  30. virtual char const *GetName();
  31. inline int IsDestroying() { return destroy; }
  32. virtual void TickGame(float deltams);
  33. virtual void TickDraw(float deltams);
  34. enum
  35. {
  36. GAMEGROUP_BEFORE = 0,
  37. GAMEGROUP_DEFAULT,
  38. GAMEGROUP_AFTER,
  39. // Must be the last element
  40. GAMEGROUP_END
  41. }
  42. gamegroup;
  43. enum
  44. {
  45. DRAWGROUP_BEFORE = GAMEGROUP_END,
  46. DRAWGROUP_DEFAULT,
  47. DRAWGROUP_HUD,
  48. DRAWGROUP_CAPTURE,
  49. // Must be the last element
  50. DRAWGROUP_END
  51. }
  52. drawgroup;
  53. static int const GAMEGROUP_BEGIN = 0;
  54. static int const DRAWGROUP_BEGIN = GAMEGROUP_END;
  55. static int const ALLGROUP_END = DRAWGROUP_END;
  56. #if !LOL_RELEASE
  57. enum
  58. {
  59. STATE_IDLE = 0,
  60. STATE_PRETICK_GAME,
  61. STATE_POSTTICK_GAME,
  62. STATE_PRETICK_DRAW,
  63. STATE_POSTTICK_DRAW,
  64. }
  65. state;
  66. #endif
  67. private:
  68. Entity *gamenext, *drawnext, *autonext;
  69. int ref, autorelease, destroy;
  70. };
  71. } /* namespace lol */
  72. #endif // __DH_ENTITY_H__