Dreikblack Posted February 17 Share Posted February 17 #include "UltraEngine.h" using namespace UltraEngine; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> menuWold; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<Widget> panel; void initGui() { auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(menuWold, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); uiCamera = CreateCamera(menuWold, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0); uiCamera->SetRenderLayers(2); uiCamera->SetClearMode(CLEAR_DEPTH); panel = CreatePanel(10, 50, 64, 64, ui->root, PANEL_DEFAULT); } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_DEFAULT); //Create a world menuWold = CreateWorld(); menuWold->RecordStats(); //Create a framebuffer framebuffer = CreateFramebuffer(window); //Create light auto light = CreateBoxLight(menuWold); light->SetRange(-10, 10); light->SetRotation(15, 15, 0); light->SetColor(2); //Create camera auto camera = CreateCamera(menuWold); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -3); camera->SetFov(70); initGui(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE)) { { auto uiWindow = ui->GetWindow(); if (uiWindow) Print("Interface provided a window"); else Print("No window provided"); } } menuWold->Update(); menuWold->Render(framebuffer, false); } return 0; } Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted February 17 Solution Share Posted February 17 Interfaces that are used in 3D graphics do not have a window to return, since they were not created on any window. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Dreikblack Posted February 18 Author Share Posted February 18 Can be added some method like SetWindow to interface? It would be more convenient to use than ActiveWindow when widget getting initialized since it could be null sometimes (when not window is not active obv.). Quote Link to comment Share on other sites More sharing options...
Josh Posted February 19 Share Posted February 19 Hmmm, that does not really make sense because there is nothing that ties a 3D interface to any particular window. There is no connection between them. A 3D interface can be drawn on the screen, it can appear on a panel in the 3D game world, or it can appear as a hovering VR menu. The same interface could appear in a framebuffer in multiple windows. Tying a 3D interface to a window would be like tying some entity to a window. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.