mirror of
https://github.com/devZoGok/vb01.git
synced 2026-08-26 19:43:30 +00:00
GUI utilities
This commit is contained in:
@@ -154,6 +154,14 @@ namespace vb01Gui{
|
|||||||
textboxes.push_back(t);
|
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) {
|
void AbstractGuiManager::removeButton(Button *b) {
|
||||||
for (int i = 0; i < buttons.size(); i++) {
|
for (int i = 0; i < buttons.size(); i++) {
|
||||||
if (b == buttons[i]) {
|
if (b == buttons[i]) {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace vb01Gui{
|
|||||||
std::vector<Button*> findClickedButtons();
|
std::vector<Button*> findClickedButtons();
|
||||||
void updateGui();
|
void updateGui();
|
||||||
void addButton(Button *b){buttons.push_back(b);}
|
void addButton(Button *b){buttons.push_back(b);}
|
||||||
|
Button* getButton(std::string);
|
||||||
void removeButton(Button*);
|
void removeButton(Button*);
|
||||||
void removeButton(std::string);
|
void removeButton(std::string);
|
||||||
void addListbox(Listbox*);
|
void addListbox(Listbox*);
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ namespace vb01Gui{
|
|||||||
rectNode->attachMesh(rect);
|
rectNode->attachMesh(rect);
|
||||||
guiNode->attachChild(rectNode);
|
guiNode->attachChild(rectNode);
|
||||||
|
|
||||||
if(separate){
|
if(separate && fontPath != ""){
|
||||||
text = new Text(fontPath, stringToWstring(name));
|
text = new Text(fontPath, stringToWstring(name));
|
||||||
|
|
||||||
float sc = .2;
|
float sc = .2;
|
||||||
|
|||||||
@@ -24,18 +24,19 @@ namespace vb01Gui{
|
|||||||
virtual void onMouseOver();
|
virtual void onMouseOver();
|
||||||
virtual void onMouseOff();
|
virtual void onMouseOff();
|
||||||
virtual void onClick(){}
|
virtual void onClick(){}
|
||||||
inline vb01::Vector3 getPos(){return pos;}
|
|
||||||
void setPos(vb01::Vector3);
|
void setPos(vb01::Vector3);
|
||||||
inline vb01::Vector2 getSize(){return size;}
|
|
||||||
void setSize(vb01::Vector2);
|
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 std::string getName(){return name;}
|
||||||
inline void setActive(bool active){this->active = active;}
|
inline void setActive(bool active){this->active = active;}
|
||||||
inline bool isSeparate(){return separate;}
|
inline bool isSeparate(){return separate;}
|
||||||
inline bool isActive(){return active;}
|
inline bool isActive(){return active;}
|
||||||
inline vb01::Vector4 getColor(){return color;}
|
inline vb01::Vector4 getColor(){return color;}
|
||||||
inline int getTrigger(){return trigger;}
|
inline int getTrigger(){return trigger;}
|
||||||
void setColor(vb01::Vector4);
|
|
||||||
void setImage(std::string);
|
|
||||||
protected:
|
protected:
|
||||||
int trigger, initWindowSize[2];
|
int trigger, initWindowSize[2];
|
||||||
bool separate, active = true, mouseOver = false;
|
bool separate, active = true, mouseOver = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user