Clone of Bael'Zharon's Respite @ https://github.com/boardwalk/bzr

Core.h 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Bael'Zharon's Respite
  3. * Copyright (C) 2014 Daniel Skorupski
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. */
  18. #ifndef BZR_CORE_H
  19. #define BZR_CORE_H
  20. #include "Resource.h"
  21. class Camera;
  22. class Config;
  23. class DatFile;
  24. class LandcellManager;
  25. class Log;
  26. class ObjectManager;
  27. struct Region;
  28. class Renderer;
  29. class ResourceCache;
  30. class SessionManager;
  31. class Core
  32. {
  33. public:
  34. static void execute();
  35. static Core& get();
  36. void stop();
  37. Config& config();
  38. Log& log();
  39. DatFile& portalDat();
  40. DatFile& cellDat();
  41. DatFile& highresDat();
  42. ResourceCache& resourceCache();
  43. LandcellManager& landcellManager();
  44. ObjectManager& objectManager();
  45. SessionManager& sessionManager();
  46. const Region& region() const;
  47. Camera& camera();
  48. #ifndef HEADLESS
  49. Renderer& renderer();
  50. #endif
  51. private:
  52. Core();
  53. void init();
  54. void cleanup();
  55. void run();
  56. void handleEvents();
  57. void step(fp_t dt);
  58. bool done_;
  59. unique_ptr<Config> config_;
  60. unique_ptr<Log> log_;
  61. unique_ptr<DatFile> portalDat_;
  62. unique_ptr<DatFile> cellDat_;
  63. unique_ptr<DatFile> highresDat_;
  64. unique_ptr<ResourceCache> resourceCache_;
  65. unique_ptr<LandcellManager> landcellManager_;
  66. unique_ptr<ObjectManager> objectManager_;
  67. unique_ptr<SessionManager> sessionManager_;
  68. ResourcePtr region_;
  69. unique_ptr<Camera> camera_;
  70. #ifndef HEADLESS
  71. unique_ptr<Renderer> renderer_;
  72. #endif
  73. };
  74. #endif