Jump to content

Move scene left


photo

Recommended Posts

Posted

I need to do a display like this,The world scene is on the left and the UI is on the right.。

925433763_0912--7337d180.thumb.png.4350841bf97251cdd473d5544270ebc2.png

  • 4 years later...
Posted

I have the same question.

  • 1 month later...
Posted

You need to use EngineWindowGroup: https://developer.unigine.com/docs/future/api/library/gui/class.enginewindowgroup
but the first window needs to be equated to the main window in the application so that the render is displayed there:

EngineWindowViewport main = WindowManager.MainWindow;

Add second:

EngineWindowViewport second = new("Second", 100, 100);

The sizes are not important, because adding them to a group resets them. In example, two windows are created, after which the width of the second one (at index 1) is changed to 1/5 of the total.

EngineWindowGroup group = new(EngineWindowGroup.GROUP_TYPE.HORIZONTAL, "Group", 1920, 1080);
group.Add(main);
group.Add(second);
main.UpdateGuiHierarchy();
main.SetHorizontalTabWidth(1, 1920 / 5);
main.Show();

 

Posted
On 2/12/2025 at 7:42 PM, moriVotum said:
EngineWindowGroup group = new(EngineWindowGroup.GROUP_TYPE.HORIZONTAL, "Group", 1920, 1080);
group.Add(main);
group.Add(second);
main.UpdateGuiHierarchy();
group.SetHorizontalTabWidth(1, 1920 / 5);
group.Show();

I've already tried it. The window decorations are turned on and I can't disable it.

Posted (edited)
10 hours ago, dmitrij.knutarev said:

I've already tried it. The window decorations are turned on and I can't disable it.

Yes, you cannot change the styles of child elements in window groups. If you need to "split" without separate windows, then there is an option to use WidgetVBox:

image.png.9386049efdcf6d094ee71078cb6feaea.png
Code:

Gui gui = WindowManager.MainWindow.Gui;
WidgetVBox widgetVBox = new(gui);
widgetVBox.Height = gui.Height;
widgetVBox.Width = 200;
widgetVBox.SetSpace(0, 5);
widgetVBox.Background = 1;
widgetVBox.BackgroundColor = new vec4(0, 0, 1, 1);
WidgetButton but = new WidgetButton(gui, "button");
but.SetPosition(2, 2);
widgetVBox.AddChild(but);
WindowManager.MainWindow.AddChild(widgetVBox, Gui.ALIGN_EXPAND | Gui.ALIGN_OVERLAP | Gui.ALIGN_TOP | Gui.ALIGN_RIGHT);

 

Edited by moriVotum
Posted

Such panel rendered on top of 3D-vewport. The question was about separate 3D-view.

Posted

Hello, there is a sample doing something really similar to what you need:

SDK Browser > Samples > Demos > C++ Samples > multi_view_split > SplitScreenCamera.h/cpp

The trick is to capture the 3D rendering into a WidgetSpriteViewport for your 3D view and render this widget over the left side of your game window.

  • Like 1
×
×
  • Create New...