sfmlFrontend.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 <diamondsquare.h>
  16. #include <mapDisplay.h>
  17. #include <markovNames.h>
  18. #include <landMap.h>
  19. #include <lightingGenerator.h>
  20. #if defined(_WIN32) || defined(WIN32) || defined(__WIN32__)
  21. #define OS_WIN
  22. #endif
  23. class SFMLFrontend {
  24. public:
  25. SFMLFrontend(unsigned screenSizeX, unsigned screenSizeY);
  26. void start();
  27. private:
  28. sf::Vector2u screenSize;
  29. sf::RenderWindow *window;
  30. #ifndef OS_WIN
  31. std::random_device *randomDevice;
  32. #endif
  33. std::mt19937 *mt;
  34. sf::Font islandNameFont;
  35. bool focus;
  36. // Whether to use the mouse as lamp or the sun in the relief (4)
  37. // mode.
  38. bool useMouseLamp;
  39. // The height of the mouse lamp
  40. double mouseLampHeight;
  41. double waterLevel;
  42. DiamondSquareMapSettings dsMapSettings;
  43. HeightmapGenerator *heightmapGenerator;
  44. MapDisplayer *mapDisplayer;
  45. MarkovNames *markovNames;
  46. LandMapGenerator *landMapGenerator;
  47. LightingGenerator *lightingGenerator;
  48. void loadFiles();
  49. void handleEvents();
  50. void handleInput();
  51. void update();
  52. void draw();
  53. void updateHeightmapDisplay();
  54. double *getClippedHeightmap(double clipValue);
  55. };