Jump to content

[SOLVED] Extern Window's gui button is not visible.(Unigine 2.16)


photo

Recommended Posts

Hello.
I'm trying to create a GUI button, but it's not outputting.
I created a window by overriding CustomSytemProxy.

CustomWinAPIProxy::CustomWinAPIProxy(HWND hwnd)
	: CustomSystemProxy( SYSTEM_PROXY_MOUSE | SYSTEM_PROXY_KEYBOARD)

And I created a window and set that window as the main window.

	*callback_ptr = Engine::get()->addCallback(Engine::CALLBACK_BEGIN_UPDATE,
		MakeCallback([callback_ptr, win_id = handle.win_id]
			{
			Engine::get()->removeCallback(Engine::CALLBACK_BEGIN_UPDATE, *callback_ptr);
			Memory::deallocate(callback_ptr);

			EngineWindowPtr engine_window = WindowManager::getWindowByID(win_id);
			if (engine_window)
			{
				engine_window->setNestedUsage(true);
				engine_window->setGroupUsage(false);
				engine_window->setMain(true);
			}
			}
	));

Rendering works normally, and mouse events are all implemented, but the GUI-related screen is not output.

	// creating a button widget and setting its caption
	WidgetButtonPtr widget_button = WidgetButton::create(
		Unigine::WindowManager::getMainWindow()->getSelfGui(), 
		"Delete");


	//ImagePtr image = Unigine::Image::create("omni_light_on.png");
	//widget_button->setImage(image);

	// setting a tooltip
	widget_button->setToolTip("Delete object(s)");

	// rearranging button size
	widget_button->arrange();

	// setting button position
	widget_button->setPosition(100, 100);


	// adding created button widget to the system GUI
	Unigine::WindowManager::getMainWindow()->getSelfGui()->addChild(widget_button, Gui::ALIGN_OVERLAP | Gui::ALIGN_FIXED);

	box = Primitives::createBox(vec3_one);

	// Write here code to be called on world initialization: initialize resources for your world scene during the world start.
	Input::addCallback(Input::CALLBACK_IMMEDIATE_INPUT, MakeCallback(on_immediate_input));

Please tell me which part needs to be fixed.
thank you

Edited by KOVIAHN
Link to comment

Hello,

Your code looks correct. I haven't been able to reproduce this behaviour. Is it possible to see at the complete implementation of the proxy and window creation?

The reason may be that you are not using the SYSTEM_PROXY_WINDOWS flag. In this case, it will not be possible to create engine windows. You can only use custom external windows for rendering, but in this case you also need to implement GUI rendering yourself.

Link to comment
  • 4 weeks later...

Dear karpych11

Currently, the program under development does not use the SYSTEM_PROXY_WINDOWS flag.

So I think the GUI is not displayed. For reference, the IMGUI provided as a separate sample is output.
We plan to implement necessary buttons by using IMGUI.


As an additional question, can't I use the Visualizer class as well?
If the Visualizer class doesn't render, it requires quite a bit of implementation. So, if it is not provided, I wonder if there is a plan to make it possible to use it in an external window through a future update.
Thank you.

Link to comment
  • silent changed the title to [SOLVED] Extern Window's gui button is not visible.(Unigine 2.16)
×
×
  • Create New...