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.cpp 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*!
  2. * \file src/RunTime.cpp
  3. * \brief run time configuration storage
  4. *
  5. * \author xythobuz
  6. */
  7. #include "global.h"
  8. #include "RunTime.h"
  9. RunTime::RunTime() {
  10. gameIsRunning = false;
  11. #ifdef DEBUG
  12. showFPS = true;
  13. #else
  14. showFPS = false;
  15. #endif
  16. for (int i = 0; i < ActionEventCount; i++)
  17. keyBindings[i] = unknownKey;
  18. // Default key bindings
  19. keyBindings[menuAction] = escapeKey;
  20. keyBindings[debugAction] = qKey;
  21. keyBindings[forwardAction] = wKey;
  22. keyBindings[backwardAction] = sKey;
  23. keyBindings[leftAction] = aKey;
  24. keyBindings[rightAction] = dKey;
  25. }
  26. std::string RunTime::getBaseDir() {
  27. return baseDir;
  28. }
  29. void RunTime::setBaseDir(std::string dir) {
  30. baseDir = dir;
  31. }
  32. std::string RunTime::getPakDir() {
  33. return pakDir;
  34. }
  35. void RunTime::setPakDir(std::string dir) {
  36. pakDir = dir;
  37. }
  38. std::string RunTime::getAudioDir() {
  39. return audioDir;
  40. }
  41. void RunTime::setAudioDir(std::string dir) {
  42. audioDir = dir;
  43. }
  44. std::string RunTime::getDataDir() {
  45. return dataDir;
  46. }
  47. void RunTime::setDataDir(std::string dir) {
  48. dataDir = dir;
  49. }
  50. KeyboardButton RunTime::getKeyBinding(ActionEvents event) {
  51. assert(event < ActionEventCount);
  52. return keyBindings[event];
  53. }
  54. void RunTime::setKeyBinding(ActionEvents event, KeyboardButton button) {
  55. assert(event < ActionEventCount);
  56. keyBindings[event] = button;
  57. }
  58. bool RunTime::isRunning() {
  59. return gameIsRunning;
  60. }
  61. void RunTime::setRunning(bool run) {
  62. gameIsRunning = run;
  63. }
  64. bool RunTime::getFPS() {
  65. return showFPS;
  66. }
  67. void RunTime::setFPS(bool fps) {
  68. showFPS = fps;
  69. }