12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- /**
- * Triangles
- * Copyright (C) 2016 POSITIVE MENTAL ATTITUDE
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #pragma once
- #include "Triangle.hpp"
- /**
- * @class GuiTriangle
- * @author POSITIVE MENTAL ATTITUDE
- * @date 05/05/16
- * @file Triangle.hpp
- * @brief All these (not so) fancy main menu triangles are GUI triangles.
- */
- class GuiTriangle: public Triangle
- {
- public:
- GuiTriangle();
- /**
- * @brief Returns the width of the triangle when it stands on its arm (rotated by 92.5°)
- */
- float getWidth();
- /**
- * @brief Checks if the cursor is inside of the triangle
- * @return boolean
- */
- bool mouseIntersection(sf::Vector2i mouseXY);
- void click(sf::Vector2i mouseXY);
- void update(sf::Vector2i mouseXY, sf::Time delta);
- void bind(const std::function<void()>& lambda);
- protected:
- virtual void redraw();
- private:
- float _scale;
- std::function<void()> onClick;
- };
|