Josh Posted 15 hours ago Share Posted 15 hours ago Just testing with tiles now... #include "Leadwerks.h" using namespace UltraEngine; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> menuWold; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); window = CreateWindow("Ultra Engine", 0, 0, 800, 250, displays[0], WINDOW_DEFAULT); menuWold = CreateWorld(); framebuffer = CreateFramebuffer(window); uiCamera = CreateCamera(menuWold, PROJECTION_ORTHOGRAPHIC); auto font = LoadFont("Fonts\\arial.ttf"); auto tile1 = CreateTile(uiCamera, 100, 12); tile1->SetColor(0, 0, 1); auto tile2 = CreateTile(uiCamera, font, "ESCpppp123", 12, TEXT_MIDDLE); tile2->SetPosition(0, 6); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { menuWold->Update(); menuWold->Render(framebuffer); } return 0; } 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...
Josh Posted 14 hours ago Share Posted 14 hours ago Since FreeType does not provide the font height, I just started using the height of the letter E for the font height, and it works fine. Problems may arise in the future for fonts that do not have this character. 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...
Josh Posted 14 hours ago Share Posted 14 hours ago Testing a multi-line label... #include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Leawerks 5", 0, 0, 800, 250, displays[0], WINDOW_DEFAULT); auto menuWold = CreateWorld(); auto framebuffer = CreateFramebuffer(window); auto uiCamera = CreateCamera(menuWold, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0); uiCamera->SetClearMode(CLEAR_DEPTH); auto default_font = LoadFont("Fonts\\arial.ttf"); auto ui = CreateInterface(uiCamera, default_font, framebuffer->GetSize()); auto panel = CreatePanel(10, 10, ui->background->size.x - 20, ui->background->size.y - 20, ui->background); panel->SetColor(0, 0, 1); auto customWidget = CreateLabel("", 0, 0, panel->size.x, panel->size.y, panel, LABEL_CENTER | LABEL_MIDDLE); customWidget->SetText("Enemy in full armored biosuit which can be penetrate only with nails.\nBalloon at the back can be destroyed and it will cause an explosion.\nHis laser rifle shoots at long range and charged shot can hit few units in the shot line."); customWidget->SetFontScale(2.0f); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { menuWold->Update(); menuWold->Render(framebuffer); } return 0; } 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...
Solution Josh Posted 13 hours ago Solution Share Posted 13 hours ago Pretty darn good now #include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Leawerks 5", 0, 0, 800, 100, displays[0], WINDOW_DEFAULT | WINDOW_CLIENTCOORDS); auto menuWold = CreateWorld(); auto framebuffer = CreateFramebuffer(window); auto uiCamera = CreateCamera(menuWold, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0); uiCamera->SetClearMode(CLEAR_DEPTH); auto default_font = LoadFont("Fonts\\arial.ttf"); auto ui = CreateInterface(uiCamera, default_font, framebuffer->GetSize()); auto panel = CreatePanel(10, 10, ui->background->size.x - 20, ui->background->size.y - 20, ui->background); panel->SetColor(0, 0, 1); String s = "Enemy in full armored biosuit which can be penetrate only with nails.\nBalloon at the back can be destroyed and it will cause an explosion.\nHis laser rifle shoots at long range and charged shot can hit few units in the shot line."; auto customWidget = CreateLabel("", 0, 0, panel->size.x, panel->size.y, panel, LABEL_CENTER | LABEL_MIDDLE); customWidget->SetText(s); customWidget->SetFontScale(2.0f); //auto tile = CreateTile(uiCamera, default_font, s, 12.0f * 2.0f, TEXT_MIDDLE); //tile->SetOrder(100000); //tile->SetPosition(10, 50); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { menuWold->Update(); menuWold->Render(framebuffer); } return 0; } 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 6 hours ago Author Share Posted 6 hours ago 7 hours ago, Josh said: E for the font height, and it works fine. Problems may arise in the future for fonts that do not have this character. Would not be some digit more reliable then? But i'm not if digits always have same height as upper letters tho. Quote 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.