TrianglesWindow.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * Triangles
  3. * Copyright (C) 2016 POSITIVE MENTAL ATTITUDE
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, version 3 of the License.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #pragma once
  18. #include <SFML/Graphics.hpp>
  19. #include <iostream>
  20. #include "InputTarget.hpp"
  21. #include "Context.hpp"
  22. class TrianglesWindow: public InputTarget<int>
  23. {
  24. public:
  25. TrianglesWindow() = delete;
  26. TrianglesWindow(const std::string& title, sf::Vector2u size);
  27. ~TrianglesWindow();
  28. void clear();
  29. void clear(sf::Color color);
  30. void render();
  31. void recreate();
  32. void lockFramerate(bool locked);
  33. void setContext(Context* context);
  34. bool setActive(bool active);
  35. void setSize(sf::Vector2u& size);
  36. void setSize(unsigned width, unsigned height);
  37. sf::Vector2u getSize();
  38. void setView(const sf::View* view);
  39. void setView();
  40. const sf::View& getDefaultView();
  41. void draw(sf::Drawable& drawable);
  42. void draw(sf::Drawable& drawable, sf::RenderStates states);
  43. void draw(sf::Drawable& drawable, sf::Shader* shader);
  44. bool pollEvent(sf::Event& event);
  45. sf::Vector2i getMousePosition();
  46. void lockMouse();
  47. void lockMouse(sf::Vector2i position);
  48. private:
  49. void open();
  50. void close();
  51. Context* _context;
  52. InputMap<int> _inputMap;
  53. sf::RenderWindow _window;
  54. sf::Vector2u _size;
  55. std::string _title;
  56. bool _mouseLocked;
  57. };