Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RunTime.h 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*!
  2. * \file include/RunTime.h
  3. * \brief Runtime Configuration Storage
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _RUNTIME_H_
  8. #define _RUNTIME_H_
  9. #include <string>
  10. #include <vector>
  11. class RunTime {
  12. public:
  13. static void initialize();
  14. static void updateFPS();
  15. static void display();
  16. static KeyboardButton getKeyBinding(ActionEvents event);
  17. static void setKeyBinding(ActionEvents event, KeyboardButton button);
  18. static std::string getBaseDir() { return baseDir; }
  19. static void setBaseDir(std::string dir) { baseDir = dir; }
  20. static std::string getPakDir() { return pakDir; }
  21. static void setPakDir(std::string dir) { pakDir = dir; }
  22. static std::string getAudioDir() { return audioDir; }
  23. static void setAudioDir(std::string dir) { audioDir = dir; }
  24. static std::string getDataDir() { return dataDir; }
  25. static void setDataDir(std::string dir) { dataDir = dir; }
  26. static bool isRunning() { return gameIsRunning; }
  27. static void setRunning(bool run) { gameIsRunning = run; }
  28. static bool getShowFPS() { return showFPS; }
  29. static void setShowFPS(bool f) { showFPS = f; }
  30. static unsigned long getFPS() { return fps; }
  31. static const std::vector<float>& getHistoryFPS() { return history; }
  32. static float getLastFrameTime() { return lastFrameTime / 1000.0f; }
  33. static void incrementCallCount() { glCallCount++; }
  34. static unsigned long getCallCount() { auto c = glCallCount; glCallCount = 0; return c; }
  35. private:
  36. static std::string baseDir;
  37. static std::string pakDir;
  38. static std::string audioDir;
  39. static std::string dataDir;
  40. static KeyboardButton keyBindings[ActionEventCount];
  41. static bool gameIsRunning;
  42. static bool showFPS;
  43. static unsigned long lastTime, lastFrameTime;
  44. static unsigned long frameCount, frameCount2;
  45. static unsigned long frameTimeSum, frameTimeSum2;
  46. static unsigned long fps;
  47. static std::vector<float> history;
  48. static unsigned long glCallCount;
  49. };
  50. #endif