1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
//MenuTest.h
#include <SFML/Graphics.hpp>
#include <string>
#include <vector>
class Menu1
{
class Button1
{
sf::RectangleShape body;
sf::Text text;
void create(float x, float y);//sets button postion
void setText();//ensures text is centered inside the button
public:
void setPosition(float x, float y);
void drawButton(sf::RenderWindow &window);
Button1(float w, float h, float x, float y, sf::Font f, std::string s="Button")
: body(sf::Vector2f(w,h)), text(s,f) {create(x,y);}
};
std::vector<Button1> MenuButtons;
public:
void draw(sf::RenderWindow &window);
void addButton(float w, float h, float x, float y, sf::Font f, std::string s="Button");
};
|