GUI utilities

This commit is contained in:
devZoGok
2024-09-27 17:28:05 +03:00
parent 4c7bc739e8
commit acac13d2ad
4 changed files with 15 additions and 5 deletions
+8
View File
@@ -154,6 +154,14 @@ namespace vb01Gui{
textboxes.push_back(t);
}
Button* AbstractGuiManager::getButton(string name){
for(Button *b : buttons)
if(b->getName() == name)
return b;
return nullptr;
}
void AbstractGuiManager::removeButton(Button *b) {
for (int i = 0; i < buttons.size(); i++) {
if (b == buttons[i]) {
+1
View File
@@ -22,6 +22,7 @@ namespace vb01Gui{
std::vector<Button*> findClickedButtons();
void updateGui();
void addButton(Button *b){buttons.push_back(b);}
Button* getButton(std::string);
void removeButton(Button*);
void removeButton(std::string);
void addListbox(Listbox*);
+1 -1
View File
@@ -46,7 +46,7 @@ namespace vb01Gui{
rectNode->attachMesh(rect);
guiNode->attachChild(rectNode);
if(separate){
if(separate && fontPath != ""){
text = new Text(fontPath, stringToWstring(name));
float sc = .2;
+5 -4
View File
@@ -24,18 +24,19 @@ namespace vb01Gui{
virtual void onMouseOver();
virtual void onMouseOff();
virtual void onClick(){}
inline vb01::Vector3 getPos(){return pos;}
void setPos(vb01::Vector3);
inline vb01::Vector2 getSize(){return size;}
void setSize(vb01::Vector2);
void setColor(vb01::Vector4);
void setImage(std::string);
inline vb01::Node* getRectNode(){return rectNode;}
inline vb01::Vector3 getPos(){return pos;}
inline vb01::Vector2 getSize(){return size;}
inline std::string getName(){return name;}
inline void setActive(bool active){this->active = active;}
inline bool isSeparate(){return separate;}
inline bool isActive(){return active;}
inline vb01::Vector4 getColor(){return color;}
inline int getTrigger(){return trigger;}
void setColor(vb01::Vector4);
void setImage(std::string);
protected:
int trigger, initWindowSize[2];
bool separate, active = true, mouseOver = false;