60 lines
1.5 KiB
C++
60 lines
1.5 KiB
C++
#ifndef __BUTTON_H__
|
|
# define __BUTTON_H__
|
|
|
|
# include <vector>
|
|
# include <string>
|
|
# include "Core/Core.hh"
|
|
# include "SubMenu.hh"
|
|
|
|
namespace DamnCute {
|
|
class Button : public IRenderable {
|
|
|
|
private:
|
|
std::vector<SubMenu*>::iterator _itSub;
|
|
std::vector<SubMenu*> _sub;
|
|
const std::string _name;
|
|
bool _alive;
|
|
int _x;
|
|
int _y;
|
|
int _offsetx = 0;
|
|
int _offsety = 0;
|
|
bool _start = false;
|
|
sf::Sprite _s;
|
|
sf::Texture& _tex;
|
|
sf::Text _text;
|
|
|
|
public:
|
|
explicit Button(const std::string &, sf::Text &, int, int, sf::Texture&);
|
|
virtual ~Button() = default;
|
|
|
|
inline void operator=(const Button& b) {
|
|
_tex = b._tex;
|
|
_s = b._s;
|
|
_text = b._text;
|
|
}
|
|
virtual void update(sf::RenderTarget*);
|
|
|
|
int getX();
|
|
int getY();
|
|
bool getStart();
|
|
const std::string getName();
|
|
|
|
void setAlive();
|
|
void setAlive2();
|
|
void setOffsets(int, int);
|
|
void setPos(int, int);
|
|
void setStart();
|
|
|
|
bool hasField(const std::string &);
|
|
const std::string getField(const std::string &);
|
|
void moveDown();
|
|
void moveUp();
|
|
void moveRight();
|
|
void moveLeft();
|
|
void addSubMenu(SubMenu *b);
|
|
|
|
};
|
|
};
|
|
|
|
#endif
|