Open Source Tomb Raider Engine
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

RunTime.h 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*!
  2. * \file include/RunTime.h
  3. * \brief run time 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. private:
  34. static std::string baseDir;
  35. static std::string pakDir;
  36. static std::string audioDir;
  37. static std::string dataDir;
  38. static KeyboardButton keyBindings[ActionEventCount];
  39. static bool gameIsRunning;
  40. static bool showFPS;
  41. static unsigned long lastTime, lastFrameTime;
  42. static unsigned long frameCount, frameCount2;
  43. static unsigned long frameTimeSum, frameTimeSum2;
  44. static unsigned long fps;
  45. static std::vector<float> history;
  46. };
  47. #endif