GuiTriangle.hpp 785 B

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include "Triangle.hpp"
  3. /**
  4. * @class GuiTriangle
  5. * @author POSITIVE MENTAL ATTITUDE
  6. * @date 05/05/16
  7. * @file Triangle.hpp
  8. * @brief All these (not so) fancy main menu triangles are GUI triangles.
  9. */
  10. class GuiTriangle: public Triangle
  11. {
  12. public:
  13. GuiTriangle();
  14. /**
  15. * @brief Returns the width of the triangle when it stands on its arm (rotated by 92.5°)
  16. */
  17. float getWidth();
  18. /**
  19. * @brief Checks if the cursor is inside of the triangle
  20. * @return boolean
  21. */
  22. bool mouseIntersection(sf::Vector2i mouseXY);
  23. void click(sf::Vector2i mouseXY);
  24. void update(sf::Vector2i mouseXY, sf::Time delta);
  25. void bind(const std::function<void()>& lambda);
  26. protected:
  27. virtual void redraw();
  28. private:
  29. float _scale;
  30. std::function<void()> onClick;
  31. };