diff --git a/GUI.cpp b/GUI.cpp index 443d33a..c22cb47 100644 --- a/GUI.cpp +++ b/GUI.cpp @@ -1,6 +1,9 @@ #include "GUI.h" -Button::Button(sf::Image* normal,sf::Image* clicked,std::string words,sf::Vector2f location) { +// Code contributed by Kacperks +// COMMENTED OUT BECAUSE IT DOESN'T WORK! +/* +Button::Button(sf::Image* normal, sf::Image* clicked, std::string words, Position2D location) { this->normal.SetImage(*normal); this->clicked.SetImage(*clicked); this->currentSpr=&this->normal; @@ -11,14 +14,17 @@ Button::Button(sf::Image* normal,sf::Image* clicked,std::string words,sf::Vector String.SetPosition(location.x+3,location.y+3); String.SetSize(14); } -void Button::checkClick (sf::Vector2f mousePos) { +void Button::checkClick (sf::Vector2f mousePos) +{ if (mousePos.x>currentSpr->GetPosition().x && mousePos.x<(currentSpr->GetPosition().x + currentSpr->GetSize().x)) { if(mousePos.y>currentSpr->GetPosition().y && mousePos.y<(currentSpr->GetPosition().y + currentSpr->GetSize().y)) { setState(!current); } } } -void Button::setState(bool which) { + +void Button::setState(bool which) +{ current = which; if (current) { currentSpr=&clicked; @@ -26,16 +32,20 @@ void Button::setState(bool which) { } currentSpr=&normal; } -void Button::setText(std::string words) { +void Button::setText(std::string words) +{ String.SetText(words); } -bool Button::getVar() { +bool Button::getVar() +{ return current; } -sf::Sprite* Button::getSprite() { +sf::Sprite* Button::getSprite() +{ return currentSpr; } -sf::String * Button::getText() { +sf::String * Button::getText() +{ return &String; -} +}*/ diff --git a/XtreemNodes.depend b/XtreemNodes.depend index c7159cb..ca522a9 100644 --- a/XtreemNodes.depend +++ b/XtreemNodes.depend @@ -1,5 +1,5 @@ # depslib dependency file v1.0 -1667180176 source:c:\development\xtreemminer\main.cpp +1667335610 source:c:\development\xtreemminer\main.cpp "Utilities.h" diff --git a/XtreemNodes.layout b/XtreemNodes.layout index 3139691..862f813 100644 --- a/XtreemNodes.layout +++ b/XtreemNodes.layout @@ -2,64 +2,54 @@ - - - - - - + - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - + - + - + + + + + + + + + + + + + + + + + + + + + - + - + diff --git a/include/GUI.h b/include/GUI.h index 3127bdc..4d49831 100644 --- a/include/GUI.h +++ b/include/GUI.h @@ -1,23 +1,26 @@ #ifndef GUI -#defome GUI - +#define GUI +#include "Base.h" #include +#include -class Button { -public: - Button (sf::Image* normal,sf::Image* clicked,std::string,sf::Vector2f location); - void checkClick (sf::Vector2f); - void setState(bool); - void setText(std::string); - bool getVar(); - sf::Sprite* getSprite(); - sf::String * getText(); -private: - sf::Sprite normal; - sf::Sprite clicked; - sf::Sprite* currentSpr; - sf::String String; - bool current; +class Button +{ + public: + Button(sf::Image* normal, sf::Image* clicked, std::string text, Position2D location); + void checkClick(Position2D); + void setState(bool state); + void setText(std::string); + bool getVar(); + sf::Sprite* getSprite(); + sf::String* getText(); + + private: + sf::Sprite normal; + sf::Sprite clicked; + sf::Sprite* currentSpr; + sf::String String; + bool current; }; -#endif // GUI +#endif