sfmlFrontend.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. Copyright (C) 2015 Marien Raat
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #include <SFML/Graphics.hpp>
  15. #include <islandHeightmapGenerator.h>
  16. #include <mapDisplay.h>
  17. #include <markovNames.h>
  18. #include <landMap.h>
  19. #include <waterGenerator.h>
  20. #include <lightingGenerator.h>
  21. #include <biomeGenerator.h>
  22. #if defined(_WIN32) || defined(WIN32) || defined(__WIN32__)
  23. #define OS_WIN
  24. #endif
  25. class SFMLFrontend {
  26. public:
  27. SFMLFrontend(unsigned screenSizeX, unsigned screenSizeY);
  28. void start();
  29. private:
  30. sf::Vector2u screenSize;
  31. sf::RenderWindow *window;
  32. #ifndef OS_WIN
  33. std::random_device *randomDevice;
  34. #endif
  35. std::mt19937 *mt;
  36. sf::Font islandNameFont;
  37. bool focus;
  38. // Whether to use the mouse as lamp or the sun in the relief (4)
  39. // mode.
  40. bool useMouseLamp;
  41. // The height of the mouse lamp
  42. double mouseLampHeight;
  43. double waterLevel;
  44. double *heightmapModifiers;
  45. IslandHeightmapGenerator *islandHeightmapGenerator;
  46. MapDisplayer *mapDisplayer;
  47. MarkovNames *markovNames;
  48. LandMapGenerator *landMapGenerator;
  49. WaterSettings waterSettings;
  50. WaterGenerator *waterGenerator;
  51. LightingGenerator *lightingGenerator;
  52. BiomeGenerator *biomeGenerator;
  53. void loadFiles();
  54. void handleEvents();
  55. void handleInput();
  56. void update();
  57. void draw();
  58. void updateHeightmapDisplay();
  59. double *getClippedHeightmap(double clipValue);
  60. };