Jump to content

ui doesn't show in game?


sdxsdx
 Share

Recommended Posts

std::shared_ptr<UltraEngine::Interface> ui = UltraEngine::CreateInterface(window);
    auto sz = ui->root->ClientSize();
    ui->SetRenderLayers(128);
    auto text = CreateTextField(0, 50, 100, 30, ui->root,UltraEngine::TEXTFIELD_DEFAULT);
    text->SetText("Hello World!");

    auto uicam = CreateCamera(world, PROJECTION_ORTHOGRAPHIC);
    uicam->SetClearMode(CLEAR_DEPTH);
    uicam->SetRenderLayers(128);
    uicam->SetPosition(framebuffer->size.x / 2, framebuffer->size.y / 2);


    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        text->SetText("Hello World!");
  
        while (PeekEvent()) {
            auto event = WaitEvent();
            ui->ProcessEvent(event);
        }
        
        world->Update();
        world->Render(framebuffer);
        
    }

Am I missing anything?

I have two camera, one camera runs the 3d world, one runs the interface;

But the 3d world camera seems to override the interface camera.

Link to comment
Share on other sites

8 minutes ago, Josh said:

You need to create the 3D camera before the UI camera, or call camera->SetOrder() to adjust the order they render in.

 

CreateTextField does not work but CreateLabel works fine.

May be I am setting something wrong?

 

 

Link to comment
Share on other sites

CreateLabel works fine.

CreateButton works fine.

CreateTextField does't work. It appeared in screen first but once the game world is complete loaded, the TextField becomes disappeared.

Maybe there is something wrong with CreateTextField?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...