Jump to content

Dreikblack

Members
  • Posts

    316
  • Joined

  • Last visited

Everything posted by Dreikblack

  1. Found out it happens only in debug mode. But i wonder now how to make existing window be fullscreen and vice verca.
  2. idk if there is another proper way to change a resolution of window. This way works in 2D UI. #include "UltraEngine.h" using namespace UltraEngine; bool EventCallback(const Event& ev, shared_ptr<Object> extra) { auto window = extra->As<Window>(); window->SetSize(1024, 768); return true; } 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 btn = CreateButton("change res", 0, 0, 100, 30, ui->root); ListenEvent(EVENT_WIDGETACTION, btn, EventCallback, window); 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; }
  3. atm i don't even see ability to set font at all aside of creation new Interface (and if it's not 2D one). Own fonts for blocks would improve aesthetic look when one font is nice for titles but bad for usual text, digets etc.
  4. Works fine in usual interface but throws an exception in case of UI in 3D rendering viewport. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 640, 480, displays[0]); // Create a world auto world = CreateWorld(); // Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create ui camera auto uiCamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition(float(framebuffer->GetSize().x) * 0.5f, float(framebuffer->GetSize().y) * 0.5f, 0); uiCamera->SetRenderLayers(2); uiCamera->SetClearMode(CLEAR_DEPTH); //Load a font auto font = LoadFont("Fonts/arial.ttf"); //Create user interface auto ui = CreateInterface(world, font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); //Create widget auto sz = ui->root->ClientSize(); auto combobox = CreateComboBox((sz.x - 300) / 2, (sz.y - 30) / 2, 300, 30, ui->root); for (int n = 0; n < 20; ++n) { combobox->AddItem("Item " + String(n), n == 0); } while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WIDGETSELECT: Print("Item " + String(ev.data) + " selected"); break; case EVENT_WINDOWCLOSE: return 0; break; } } }
  5. Can't even cancel build and have to restart Visual Studio every time when it just happens. idk if it relates to Ultra, i'm using VS only for it nowadays.
  6. Yes, i updated projects after last update. Actually have same error even without quake plugin with Samurai model example.
  7. After last update in-engine model load broke. Can be reproduced with a code above.
  8. Quake model from pak is not visible in the engine. I can see model being loaded in debug (i.e. model var is not empty) but scene is empty. PAK0 is in app dir (because of shader issue, crash if pak in game folder atm). #include "UltraEngine.h" #include "Components/CameraControls.hpp" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world auto world = CreateWorld(); world->SetAmbientLight(0); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Load FreeImage plugin auto plg = LoadPlugin("Plugins/FITextureLoader"); auto quakeLoaderPlugin = LoadPlugin("Plugins/QuakeLoader"); //Load model WString path = AppDir(); auto pak = LoadPackage(path + "/PAK0.PAK"); ChangeDir(path); auto model = LoadModel(world, "progs/quaddama.mdl"); model->Turn(0, 180, 0, true); //Environment maps auto specmap = LoadTexture("https://github.com/UltraEngine/Assets/raw/main/Materials/Environment/footprint_court/specular.dds"); auto diffmap = LoadTexture("https://github.com/UltraEngine/Assets/raw/main/Materials/Environment/footprint_court/diffuse.dds"); world->SetEnvironmentMap(diffmap, ENVIRONMENTMAP_BACKGROUND); world->SetEnvironmentMap(specmap, ENVIRONMENTMAP_SPECULAR); world->SetEnvironmentMap(diffmap, ENVIRONMENTMAP_DIFFUSE); //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")); //Add camera controls camera->AddComponent<CameraControls>(); //Create light auto light = CreateBoxLight(world); light->SetRange(-10, 10); light->SetArea(15, 15); light->SetRotation(45, 35, 0); light->SetColor(1.2); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  9. I guess this for using game models from legal game copy of player? Yea, it would much better than having their models in my game client since only Quake code is free to use but not content (even for uncomectial games i guess). I forgot about that tbh Thanks!
  10. Want to make little fan game to have code foundation (GUI, gameplay base, etc.) for next games and ready Quake assets for Quake theme game will save my time a lot at this stage.
  11. Thanks! I did it and now it works for me.
  12. I was interested in just Quake model plagin for now. I have a problem with it btw. I updated client and project but have no thumbnails and there is error when i'm trying to open model in editor:
  13. Pixmap seems to ignores alpha chanal at all: drawCircle(pixmap, 50, 50, 25, Rgba(100, 50, 150, 255)); drawCircle(pixmap, 50, 50, 30, Rgba(100, 50, 150, 0)); drawCircle(pixmap, 50, 50, 35, Rgba(100, 50, 150, 133)); btw slider has issue in fisrt and last position. Also i wonder how triangles button are made, no problem with their background. No source here: here https://github.com/Leadwerks/UltraEngine/tree/main/Source/Classes/GUI Same 3 circles with no 3D World behind UI for comparison:
  14. In full 2D works fine but in 3D it's a black background in Pixmap area where should be transparent pixels. Probably Vulkan things this time too? Just want to be sure if it will be fixed later in Ultra or i'm missing something. #include "UltraEngine.h" using namespace UltraEngine; void drawPixel(shared_ptr<Pixmap> pixmap, const int x, const int y, unsigned int color) { if (pixmap && x >= 0 && x < pixmap->size.width && y >= 0 && y < pixmap->size.height) { pixmap->WritePixel(x, y, color); } } void drawCircle(shared_ptr<Pixmap> pixmap, const int centerX, const int centerY, const int radius, unsigned int color) { int x = 0; int y = radius; int delta = 1 - 2 * radius; int error = 0; while (y >= 0) { drawPixel(pixmap, centerX + x, centerY + y, color); drawPixel(pixmap, centerX + x, centerY - y, color); drawPixel(pixmap, centerX - x, centerY + y, color); drawPixel(pixmap, centerX - x, centerY - y, color); error = 2 * (delta + y) - 1; if (delta < 0 && error <= 0) { ++x; delta += 2 * x + 1; continue; } error = 2 * (delta - x) - 1; if (delta > 0 && error > 0) { --y; delta += 1 - 2 * y; continue; } ++x; delta += 2 * (x - y); --y; } } 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 panel = CreatePanel(0, 0, 200, 200, ui->root); auto pixmap = UltraEngine::CreatePixmap(100, 100); drawCircle(pixmap, 50, 50, 25, Rgba(100, 50, 150, 255)); panel->SetPixmap(pixmap); panel->SetColor(0.1f, 0.15f, 0.1f, 1); 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; }
  15. @dugrosettehttps://www.leadwerks.com/learn - Leadwerks documentation
  16. 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; } 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.
  17. 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.
  18. Ultra Editor missing Quake Model Loader plugin and idk how to properly build it from: https://github.com/UltraEngine/PluginSDK/tree/master/Plugins/Quake Model Loader I tried to open Quake Model Loader project and build solution but can't due errors: I can fix few incudes but still missing GMFSDK at least.
  19. Does Ultra supports Quake 1 model animation btw?
  20. Turn based tactics in Quake 1 settings. Link to this demo: https://drive.google.com/drive/folders/1d5QKGvv0ikCDG9Pe1gIS8sg0hhkbybn_?usp=sharing ORIGINAL POST: Quake Tactics (early 2D prototype). Made this with Ultra App Kit. Will swtich to Ultra Engine as soon as it will be possible for me to buy the subscription. Quake Tactics is my fan uncommercial game about Slipgate marines squad before Quake 1 events. In terms of gameplay my goal is to make something between such games as Into the Breach and XCOM.
  21. Just redraw() did not worked for me either. "textfield->SetText(textfield->GetText());" with redraw made a field to change text style. Other style, TEXTFIELD_READONLY, works with no calling a redraw or changes of text. Style is just an int basically. In Draw() method Widget checks which one is applied and changes accordingly to it. You can see how some of widgets works here - https://github.com/Leadwerks/UltraEngine/tree/main/Source/Classes/GUI
  22. If style will be protected you can make a child widget with a method to change style for such cases
  23. I made it work by this way 😁 if (ev.source == checkbox) { if (checkbox->GetState() == WIDGETSTATE_SELECTED) { textfield->style = TEXTFIELD_PASSWORD; } else { textfield->style = TEXTFIELD_DEFAULT; } textfield->SetText(textfield->GetText()); textfield->Redraw(); }
×
×
  • Create New...