Jump to content

Text higher than should be


Dreikblack
 Share

Go to solution Solved by Josh,

Recommended Posts

Works as intended in full 2D but if UI over 3D a text is not centerd vertically.

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    auto displays = GetDisplays();
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);
    auto world = CreateWorld();
    auto framebuffer = CreateFramebuffer(window);

    auto camera = CreateCamera(world);
    camera->SetClearColor(0.125);
    camera->SetFov(70);
    camera->SetPosition(0, 0, -3);

    auto default_font = LoadFont("Fonts\\arial.ttf");
    auto ui = CreateInterface(world, default_font, framebuffer->GetSize());
    ui->SetRenderLayers(2);
    ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f);

    auto ui_camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC);
    ui_camera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0);
    ui_camera->SetRenderLayers(2);
    ui_camera->SetClearMode(CLEAR_DEPTH);

    auto button = CreateButton("Button", 10, 10, 120, 30, ui->root);

    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        while (PeekEvent()) {
            auto ev = WaitEvent();
            ui->ProcessEvent(ev);
        }

        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

image.png.da59b395601cc7cbdbd609541720f75b.png

 

Same even if i'm using in custom widget textAlignment = TEXT_CENTER | TEXT_MIDDLE but text higher than center.

Probably i'm missing something and cameras or something else should be configured differently in code.

 

  • Thanks 1
Link to comment
Share on other sites

  • Solution

There are some known drawing bugs when the GUI is used in a Vulkan framebuffer. I've been considering these relatively low-priority for now. They will get fixed, but not right away.

  • Thanks 1

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

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...