sergey.pozhidaev Posted December 2, 2013 Share Posted December 2, 2013 Hi, everyone! I can not set a color of my WidgetVBox object so that when I do it, rung object doesn't get the color. class Rung : Unigine::Widgets::Canvas ... class Workspace : Unigine::Widgets::Widget { Rung rung; Unigine::Widgets::VBox box; Workspace() { box = new Unigine::Widgets::VBox(); widget = box.widget; // Добавляем rung в workspace rung = new Rung(); widget.addChild(rung.widget, GUI_ALIGN_TOP | GUI_ALIGN_LEFT); this.setHeight(600); this.setWidth(800); box.setBackground(1); box.setColor(vec4(0, 0.98, 0.98, 1)); } ~Workspace() { } }; Link to comment
frustum Posted December 5, 2013 Share Posted December 5, 2013 Can't reproduce this problem on latest SDK. Is the Rung is 100% canvas based widget? Link to comment
sergey.pozhidaev Posted December 7, 2013 Author Share Posted December 7, 2013 No, I've got a previous one that is Unigine evaluation. And Rung is 100% canvas based widget. Link to comment
azagniy Posted December 23, 2013 Share Posted December 23, 2013 everything works, checked it on this code sample. #include <core/unigine.h> #include <core/systems/widgets/widget.h> #include <core/systems/widgets/widget_canvas.h> #include <core/systems/widgets/widget_vbox.h> Gui gui; class Rung : Unigine::Widgets::Canvas { Rung() { int width = gui.getWidth(); int height = gui.getHeight(); int line = addLine(); addLinePoint(line,vec3(0,0,0)); addLinePoint(line,vec3(width,height,0)); line = addLine(); addLinePoint(line,vec3(width,0,0)); addLinePoint(line,vec3(0,height,0)); } }; class Workspace : Unigine::Widgets::Widget { Rung rung; Unigine::Widgets::VBox box; Workspace() { box = new Unigine::Widgets::VBox(); widget = box.widget; rung = new Rung(); widget.addChild(rung.widget,GUI_ALIGN_TOP | GUI_ALIGN_LEFT); this.setHeight(600); this.setWidth(800); box.setBackground(1); box.setColor(vec4(0.0f,0.98f,0.98f,1.0f)); gui.addChild(box.widget,GUI_ALIGN_TOP | GUI_ALIGN_LEFT); } ~Workspace() { } }; int init() { Player player = new PlayerSpectator(); player.setDirection(Vec3(0.755f,-1.0f,0.25f)); engine.game.setPlayer(player); engine.game.setEnabled(1); gui = engine.getGui(); Workspace w = new Workspace(); return 1; } 1 Link to comment
Recommended Posts