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

RunTime.h 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. /*!
  12. * \brief Main Game Singleton
  13. */
  14. class RunTime {
  15. public:
  16. RunTime();
  17. std::string getBaseDir();
  18. void setBaseDir(std::string dir);
  19. std::string getPakDir();
  20. void setPakDir(std::string dir);
  21. std::string getAudioDir();
  22. void setAudioDir(std::string dir);
  23. std::string getDataDir();
  24. void setDataDir(std::string dir);
  25. KeyboardButton getKeyBinding(ActionEvents event);
  26. void setKeyBinding(ActionEvents event, KeyboardButton button);
  27. bool isRunning();
  28. void setRunning(bool run);
  29. bool getShowFPS();
  30. void setShowFPS(bool fps);
  31. void updateFPS();
  32. unsigned long getFPS();
  33. const std::vector<float>& getHistoryFPS();
  34. private:
  35. std::string baseDir;
  36. std::string pakDir;
  37. std::string audioDir;
  38. std::string dataDir;
  39. KeyboardButton keyBindings[ActionEventCount];
  40. bool gameIsRunning;
  41. bool showFPS;
  42. unsigned long lastTime;
  43. unsigned long frameCount, frameCount2;
  44. unsigned long frameTimeSum, frameTimeSum2;
  45. unsigned long fps;
  46. std::vector<float> history;
  47. };
  48. RunTime& getRunTime();
  49. #endif