GameDetails.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * This source file is part of libRocket, the HTML/CSS Interface Middleware
  3. *
  4. * For the latest information, see http://www.librocket.com
  5. *
  6. * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9. * of this software and associated documentation files (the "Software"), to deal
  10. * in the Software without restriction, including without limitation the rights
  11. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. * copies of the Software, and to permit persons to whom the Software is
  13. * furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in
  16. * all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24. * THE SOFTWARE.
  25. *
  26. */
  27. #include "GameDetails.h"
  28. static GameDetails::Difficulty difficulty = GameDetails::EASY;
  29. static Rocket::Core::Colourb colour = Rocket::Core::Colourb(255, 0, 0);
  30. static int score = -1;
  31. static int wave = 0;
  32. static bool paused = false;
  33. static GameDetails::GraphicsQuality graphics_quality = GameDetails::OK;
  34. static bool reverb = true;
  35. static bool spatialisation = false;
  36. GameDetails::GameDetails()
  37. {
  38. }
  39. GameDetails::~GameDetails()
  40. {
  41. }
  42. // Sets the game difficulty.
  43. void GameDetails::SetDifficulty(Difficulty _difficulty)
  44. {
  45. difficulty = _difficulty;
  46. }
  47. // Returns the game difficulty.
  48. GameDetails::Difficulty GameDetails::GetDifficulty()
  49. {
  50. return difficulty;
  51. }
  52. // Sets the colour of the player's ship.
  53. void GameDetails::SetDefenderColour(const Rocket::Core::Colourb& _colour)
  54. {
  55. colour = _colour;
  56. }
  57. // Returns the player's ship colour.
  58. const Rocket::Core::Colourb& GameDetails::GetDefenderColour()
  59. {
  60. return colour;
  61. }
  62. // Sets the score the player achieved in the last game.
  63. void GameDetails::SetScore(int _score)
  64. {
  65. score = _score;
  66. }
  67. // Resets the player's score.
  68. void GameDetails::ResetScore()
  69. {
  70. score = -1;
  71. }
  72. // Returns the score the player achieved in the last game.
  73. int GameDetails::GetScore()
  74. {
  75. return score;
  76. }
  77. // Set the current wave number
  78. void GameDetails::SetWave(int _wave)
  79. {
  80. wave = _wave;
  81. }
  82. // Get the current wave number
  83. int GameDetails::GetWave()
  84. {
  85. return wave;
  86. }
  87. // Sets the pauses state of the game
  88. void GameDetails::SetPaused(bool _paused)
  89. {
  90. paused = _paused;
  91. }
  92. // Gets if the game is paused or not
  93. bool GameDetails::GetPaused()
  94. {
  95. return paused;
  96. }
  97. // Sets the quality of the graphics used in-game.
  98. void GameDetails::SetGraphicsQuality(GraphicsQuality quality)
  99. {
  100. graphics_quality = quality;
  101. }
  102. // Returns the quality of the graphics to use in-game.
  103. GameDetails::GraphicsQuality GameDetails::GetGraphicsQuality()
  104. {
  105. return graphics_quality;
  106. }
  107. // Enables or disables reverb.
  108. void GameDetails::SetReverb(bool enabled)
  109. {
  110. reverb = enabled;
  111. }
  112. // Returns the current state of reverb.
  113. bool GameDetails::GetReverb()
  114. {
  115. return reverb;
  116. }
  117. // Enables or disables 3D spatialisation in the audio engine.
  118. void GameDetails::Set3DSpatialisation(bool enabled)
  119. {
  120. spatialisation = enabled;
  121. }
  122. // Returns the current state of audio spatialisation.
  123. bool GameDetails::Get3DSpatialisation()
  124. {
  125. return spatialisation;
  126. }