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

66 行
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. #pragma once
  13. //
  14. // The ticker class
  15. // ————————————————
  16. // The ticker is a static class that registers entities and ticks them.
  17. //
  18. #include <lol/engine/tickable.h>
  19. #include <cstdint>
  20. #include <memory>
  21. namespace lol
  22. {
  23. class ticker
  24. {
  25. public:
  26. static void setup(float fps);
  27. static void tick_draw();
  28. static void teardown();
  29. static void add(std::shared_ptr<tickable> entity);
  30. static void remove(std::shared_ptr<tickable> entity);
  31. // The old API
  32. static void Register(class entity *entity);
  33. static void Ref(class entity *entity);
  34. static int Unref(class entity *entity);
  35. static void StartBenchmark();
  36. static void StopBenchmark();
  37. static void StartRecording();
  38. static void StopRecording();
  39. static int GetFrameNum();
  40. static void SetState(class entity *entity, uint32_t state);
  41. static void SetStateWhenMatch(class entity *entity, uint32_t state,
  42. class entity *other_entity, uint32_t other_state);
  43. static void Shutdown();
  44. static int Finished();
  45. private:
  46. ticker() {}
  47. };
  48. // The old API
  49. typedef ticker Ticker;
  50. } /* namespace lol */