mirror of
https://github.com/devZoGok/vb01.git
synced 2026-08-26 19:43:30 +00:00
+8
-8
@@ -45,11 +45,6 @@ namespace vb01Gui{
|
|||||||
Vector2 mousePos = getCursorPos();
|
Vector2 mousePos = getCursorPos();
|
||||||
guiNode = Root::getSingleton()->getGuiNode();
|
guiNode = Root::getSingleton()->getGuiNode();
|
||||||
|
|
||||||
string texUni = "texturingEnabled", diffColUni = "diffuseColor";
|
|
||||||
textMat = new Material(root->getLibPath() + "text");
|
|
||||||
textMat->addBoolUniform(texUni, false);
|
|
||||||
textMat->addVec4Uniform(diffColUni, Vector4::VEC_IJKL);
|
|
||||||
|
|
||||||
if(!lines.empty()){
|
if(!lines.empty()){
|
||||||
for(int i = 0; i < lines.size(); i++)
|
for(int i = 0; i < lines.size(); i++)
|
||||||
addLine(stringToWstring(lines[i]));
|
addLine(stringToWstring(lines[i]));
|
||||||
@@ -66,8 +61,8 @@ namespace vb01Gui{
|
|||||||
Quad *selRect = new Quad(Vector3(size.x, size.y, 0), false);
|
Quad *selRect = new Quad(Vector3(size.x, size.y, 0), false);
|
||||||
selRectNode = new Node(Vector3(size.x, size.y, -.05));
|
selRectNode = new Node(Vector3(size.x, size.y, -.05));
|
||||||
Material *mat = new Material(root->getLibPath() + "gui");
|
Material *mat = new Material(root->getLibPath() + "gui");
|
||||||
mat->addBoolUniform(texUni, false);
|
mat->addBoolUniform("texturingEnabled", false);
|
||||||
mat->addVec4Uniform(diffColUni, Vector4(.6, .35, .05, 1));
|
mat->addVec4Uniform("diffuseColor", Vector4(.6, .35, .05, 1));
|
||||||
selRect->setMaterial(mat);
|
selRect->setMaterial(mat);
|
||||||
selRectNode->attachMesh(selRect);
|
selRectNode->attachMesh(selRect);
|
||||||
selRectNode->setVisible(false);
|
selRectNode->setVisible(false);
|
||||||
@@ -218,9 +213,14 @@ namespace vb01Gui{
|
|||||||
void Listbox::addLine(wstring line){
|
void Listbox::addLine(wstring line){
|
||||||
float sc = .2;
|
float sc = .2;
|
||||||
Node *node = new Node(pos + Vector3(0, size.y * (lines.size() + 1), 0) + textOffset, Quaternion::QUAT_W, Vector3(sc, sc, 1));
|
Node *node = new Node(pos + Vector3(0, size.y * (lines.size() + 1), 0) + textOffset, Quaternion::QUAT_W, Vector3(sc, sc, 1));
|
||||||
Root::getSingleton()->getGuiNode()->attachChild(node);
|
Root *root = Root::getSingleton();
|
||||||
|
root->getGuiNode()->attachChild(node);
|
||||||
node->setVisible(false);
|
node->setVisible(false);
|
||||||
|
|
||||||
|
Material *textMat = new Material(root->getLibPath() + "text");
|
||||||
|
textMat->addBoolUniform("texturingEnabled", false);
|
||||||
|
textMat->addVec4Uniform("diffuseColor", Vector4::VEC_IJKL);
|
||||||
|
|
||||||
Text *text = new Text(fontPath, line);
|
Text *text = new Text(fontPath, line);
|
||||||
text->setMaterial(textMat);
|
text->setMaterial(textMat);
|
||||||
node->addText(text);
|
node->addText(text);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace vb01Gui{
|
|||||||
void scrollToHeight(float);
|
void scrollToHeight(float);
|
||||||
virtual void onOpen(){}
|
virtual void onOpen(){}
|
||||||
virtual void onClose(){}
|
virtual void onClose(){}
|
||||||
|
inline vb01::Text* getLineText(int i){return lines[i];}
|
||||||
inline void setName(std::string n){this->name = n;}
|
inline void setName(std::string n){this->name = n;}
|
||||||
inline std::string getName(){return name;}
|
inline std::string getName(){return name;}
|
||||||
inline int getScrollOffset(){return scrollOffset;}
|
inline int getScrollOffset(){return scrollOffset;}
|
||||||
@@ -69,7 +70,6 @@ namespace vb01Gui{
|
|||||||
ScrollingButton *scrollingButton;
|
ScrollingButton *scrollingButton;
|
||||||
vb01::Node *selRectNode, *guiNode;
|
vb01::Node *selRectNode, *guiNode;
|
||||||
std::vector<vb01::Text*> lines;
|
std::vector<vb01::Text*> lines;
|
||||||
vb01::Material *textMat = nullptr;
|
|
||||||
protected:
|
protected:
|
||||||
int selectedOption = 0;
|
int selectedOption = 0;
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user