Jump to content

WidgetVBox children align error


photo

Recommended Posts

Posted

WidgetVBox and WidgetHBox have different results with children align:

 

WidgetVBox mainPanelA = new WidgetVBox(gui);
gui.addChild(mainPanelA, 0);

WidgetSprite facePanel_1 = new WidgetSprite(gui, "source/textures/first.png");
mainPanelA.addChild(facePanel_1, GUI_ALIGN_BACKGROUND);

WidgetSprite facePanel_3 = new WidgetSprite(gui, "source/textures/second.png");
mainPanelA.addChild(facePanel_3, GUI_ALIGN_OVERLAP);

facePanel_3.setBlendFunc(GUI_BLEND_SRC_ALPHA, GUI_BLEND_ONE_MINUS_SRC_ALPHA);
facePanel_3.setColor(vec4(1.0f, 1.0f, 1.0f, 0.6f));

 

WidgetHBox mainPanelA = new WidgetHBox(gui);
gui.addChild(mainPanelA, 0);

WidgetSprite facePanel_1 = new WidgetSprite(gui, "source/textures/first.png");
mainPanelA.addChild(facePanel_1, GUI_ALIGN_BACKGROUND);

WidgetSprite facePanel_3 = new WidgetSprite(gui, "source/textures/second.png");
mainPanelA.addChild(facePanel_3, GUI_ALIGN_OVERLAP);

facePanel_3.setBlendFunc(GUI_BLEND_SRC_ALPHA, GUI_BLEND_ONE_MINUS_SRC_ALPHA);
facePanel_3.setColor(vec4(1.0f, 1.0f, 1.0f, 0.6f));

results:

post-151-0-61367500-1299058556_thumb.jpg

Posted

VBox is always expands horizontally inside the other VBox.

HBox is always expands vertically inside the other HBox.

 

Gui has internal VBox container. And because of this your mainPanelA widget is expanded.

×
×
  • Create New...