rdpobsss Posted March 3, 2023 Share Posted March 3, 2023 It seems that I can't directly use the code from the documentation on how to create a button and I want to just make a pause button then pop up a panel that has a menu function in it, can someone help me with that? appreciate it. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted March 3, 2023 Share Posted March 3, 2023 What code are you having problems with in the docs? Do you have a subscription for Ultra? Quote Link to comment Share on other sites More sharing options...
Dreikblack Posted April 24, 2023 Share Posted April 24, 2023 (edited) Probably he was talking about https://www.ultraengine.com/learn/CreateInterface?lang=cpp Should 2nd example looks like that? https://www.ultraengine.com/learn/CreateCamera?lang=cpp says there should be 2 cameras for scene and UI but i still having same pic with this code: #include "UltraEngine.h" #include "Components/CameraControls.hpp" 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(); world->SetAmbientLight(0); auto framebuffer = CreateFramebuffer(window); auto plg = LoadPlugin("Plugins/FITextureLoader"); auto model = LoadModel(world, "https://github.com/UltraEngine/Documentation/raw/master/Assets/Models/Characters/cyber_samurai.glb"); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 1.4, -1); camera->SetFov(70); camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/FXAA.json")); //Create light auto light = CreateBoxLight(world); light->SetRange(-10, 10); light->SetArea(15, 15); light->SetRotation(45, 35, 0); light->SetColor(1.2); //Load a font auto font = LoadFont("Fonts/arial.ttf"); //Create user interface auto ui = CreateInterface(world, font, framebuffer->GetSize()); //Create widget iVec2 sz = ui->root->ClientSize(); auto button = CreateButton("Button", sz.x / 2 - 75, sz.y / 2 - 15, 150, 30, ui->root); //Create camera auto uiCamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition(float(framebuffer->GetSize().x) * 0.5f, float(framebuffer->GetSize().y) * 0.5f, 0); while (true) { while (PeekEvent()) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: if (ev.source == window) { return 0; } break; default: ui->ProcessEvent(ev); break; } } world->Update(); world->Render(framebuffer); } return 0; } Some simple example with 3D scene and 2D UI above would help me a lot. UPDATE: i fixed my problem with ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); Apparently it was just a background that covered 3D scene. Edited April 24, 2023 by Dreikblack found solution for myself Quote Link to comment Share on other sites More sharing options...
Josh Posted April 24, 2023 Share Posted April 24, 2023 On 3/3/2023 at 6:36 AM, rdpobsss said: It seems that I can't directly use the code from the documentation on how to create a button and I want to just make a pause button then pop up a panel that has a menu function in it, can someone help me with that? appreciate it. If you are using Leadwerks, the default first-person shooter template includes a menu that appears when you press the escape key. Leadwerks documentation is here: https://leadwerks.com/learn 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...
SpiderPig Posted April 24, 2023 Share Posted April 24, 2023 10 hours ago, Dreikblack said: UPDATE: i fixed my problem with ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); @Josh I wonder if the ui->root should be transparent by default? Quote Link to comment Share on other sites More sharing options...
Josh Posted April 25, 2023 Share Posted April 25, 2023 @rdpobsss Are you using Ultra Engine or Ultra App Kit from Steam? 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.