TrianglesWindow.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. void draw(sf::Drawable& drawable);
  41. void draw(sf::Drawable& drawable, sf::RenderStates states);
  42. void draw(sf::Drawable& drawable, sf::Shader* shader);
  43. bool pollEvent(sf::Event& event);
  44. sf::Vector2i getMousePosition();
  45. void lockMouse();
  46. void lockMouse(sf::Vector2i position);
  47. private:
  48. void open();
  49. void close();
  50. Context* _context;
  51. InputMap<int> _inputMap;
  52. sf::RenderWindow _window;
  53. sf::Vector2u _size;
  54. std::string _title;
  55. bool _mouseLocked;
  56. };