Jump to content

Dreikblack

Members
  • Posts

    516
  • Joined

  • Last visited

Everything posted by Dreikblack

  1. Template map. If you hit Enter before activating doors SlidingDoor count will be zero but if you do it after triggering a doors a count will be few dozens. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { RegisterComponents(); auto fiplugin = LoadPlugin("Plugins/FITextureLoader"); auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); WString mapname = "Maps/start.ultra"; auto scene = LoadMap(world, mapname); std::weak_ptr<SlidingDoor> slidingDoor; //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyDown(KEY_ENTER)) { for (auto& entity : scene->entities) { if (entity && entity->GetComponent<SlidingDoor>()) { slidingDoor = entity->GetComponent<SlidingDoor>(); scene->RemoveEntity(entity); Print(slidingDoor.use_count()); break; } } } world->Update(); world->Render(framebuffer); } return 0; }
  2. Default start map from template Happens after first enter press: Comment in loop "world = CreateWorld();" to get another render crash (RecordDraw) but it's not consistent and may take several attempts (Andy have this issue i believe): #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { RegisterComponents(); auto fiplugin = LoadPlugin("Plugins/FITextureLoader"); auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); WString mapname = "Maps/start.ultra"; auto scene = LoadMap(world, mapname); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyDown(KEY_ENTER)) { world = CreateWorld(); scene = LoadMap(world, mapname); } world->Update(); world->Render(framebuffer); } return 0; }
  3. With newest update Lua example works now as well,
  4. Last C++ examples works fine now but initial LUA example still have same issue
  5. Removed player and added a usual camera to start map - no issues
  6. Reproduced it even with one loop in one main.cpp file. Not creating game gui in callback this time. Have no idea what causing an issue now beside switching between worlds which is somehow working in my Quake Tactics project. btw you mentioned that no issue happens with other map - could be a problem related to player controller or something like that? #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; shared_ptr<World> gameWorld; shared_ptr<Interface> gameUi; shared_ptr<Camera> uiCamera; shared_ptr<Map> gameScene; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<Widget> menuPanel; bool isMenuOn = false; bool isMainMenuOn = true; bool resumeGameButtonCallback(const Event& ev, shared_ptr<Object> extra) { menuPanel->SetHidden(true); isMenuOn = false; return true; } bool mainMenuButtonCallback(const Event& ev, shared_ptr<Object> extra) { isMainMenuOn = true; return true; } bool newGameButtonCallback(const Event& ev, shared_ptr<Object> extra) { isMainMenuOn = false; return true; } bool exitButtonCallback(const Event& ev, shared_ptr<Object> extra) { exit(0); return true; } void guiInit() { // Load a font auto font = LoadFont("Fonts/arial.ttf"); // Create user interface gameUi = CreateInterface(gameWorld, font, framebuffer->GetSize()); gameUi->SetRenderLayers(2); gameUi->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); gameUi->LoadColorScheme("Resources/configs/Style.json"); // Create ui camera uiCamera = CreateCamera(gameWorld, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition(float(framebuffer->GetSize().x) * 0.5f, float(framebuffer->GetSize().y) * 0.5f, 0); uiCamera->SetRenderLayers(2); uiCamera->SetClearMode(CLEAR_DEPTH); int menuWidth = 200; int menuHeight = 200; int indent = 25; menuPanel = CreatePanel(framebuffer->size.x * 0.5 - menuWidth / 2, framebuffer->size.y * 0.5 - menuHeight / 2, menuWidth, menuHeight, gameUi->root); menuPanel->SetColor(0.2, 0.2, 0.2, 1); menuPanel->SetLayout(1, 1, 1, 1); menuPanel->SetHidden(true); int buttonWidth = menuWidth - indent * 2; int buttonHeight = 50; int posIter = 0; int buttonY = indent + posIter * (buttonHeight + indent); auto resumeButton = CreateButton("Resume", indent, buttonY, buttonWidth, buttonHeight, menuPanel); ListenEvent(EVENT_WIDGETACTION, resumeButton, resumeGameButtonCallback); posIter = posIter + 1; buttonY = indent + posIter * (buttonHeight + indent); auto mainMenuButton = CreateButton("Main Menu", indent, buttonY, buttonWidth, buttonHeight, menuPanel); ListenEvent(EVENT_WIDGETACTION, mainMenuButton, mainMenuButtonCallback); } int main(int argc, const char* argv[]) { RegisterComponents(); //Load FreeImage plugin (optional) auto fiplugin = LoadPlugin("Plugins/FITextureLoader"); //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a framebuffer framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //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.2f, 0.2f, 0.2f, 1.0f); ui->LoadColorScheme("Resources/configs/Style.json"); //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); auto newGameButton = CreateButton("New game", 200, 125, 200, 50, ui->root); ListenEvent(EVENT_WIDGETACTION, newGameButton, newGameButtonCallback); auto exitButton = CreateButton("Exit", 200, 200, 200, 50, ui->root); ListenEvent(EVENT_WIDGETACTION, exitButton, exitButtonCallback); gameWorld = CreateWorld(); gameWorld->RecordStats(); WString mapName = "Maps/start.ultra"; gameScene = LoadMap(gameWorld, mapName); guiInit(); shared_ptr<World> currentWorld = world; shared_ptr<Interface> currentUI = ui; while (window->Closed() == false) { if (isMainMenuOn) currentWorld = world; else currentWorld = gameWorld; if (isMainMenuOn) currentUI = ui; else currentUI = gameUi; if (window->KeyDown(KEY_ESCAPE) == true) { menuPanel->SetHidden(false); isMenuOn = true; window->SetMousePosition(framebuffer->size.x * 0.5, framebuffer->size.y * 0.5); } while (PeekEvent()) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: if (ev.source == window) { exit(0); break; } break; default: currentUI->ProcessEvent(ev); break; } } currentWorld->Update(); currentWorld->Render(framebuffer); } return 0; }
  7. I did it If pausing while inf. loop: Game.cpp Game.h main.cpp
  8. What was structure of app? I can try to replicate exactly same app in C++. Why tho? Maybe this is a reason why i have no problem with similar structure in main project, i'm using lambdas instead of events for by buttons there. I have two loops for two worlds. Loop inside of loop is just side effect of it What should be approach for few worlds? I will also to try do it with same loop for this case but i fail to see a problem beside issue that could be related to something else like ui created in event callback.
  9. For console local texture = LoadTexture("/Materials/Developer/trigger.dds") local material = CreateMaterial() material:SetTexture(texture) local selected = program:GetSelection() for n = 1, #selected do local currentBrush = Brush(selected[n].entity) if currentBrush ~= nil then currentBrush:SetMaterial(material) currentBrush:Build() end end
  10. Yes. Uncomment "local texture = LoadTexture("/Materials/Developer/trigger.dds")" and comment a line above it. Still need to enter any text to texture name field to apply trigger texture
  11. 1. New game 2. Esc to call menu 3. Press Main menu 4. Continue game 5. If no app is froze yet do paragraph 2 again. Usually it happens at 2nd continue game but often happen at 1st too, Same approach works for me in main C++ project, game.lua globals.lua main.lua
  12. 1. Apply texture to brush 2, Select faces of brush and do auto UV with enabled Unity faces 3. In .ultra file path looks like "texture0": "./Test Project/gfx/all.wad/crate0_top" and after restarting editor (and game) can't load this texture If i fix it manually to "/gfx/all.wad/crate0_top" textures loads correctly I'm using own extension to apply textures from all.wad from rerelase pak0. Textures names "city4_2", "crate0_top". Same happens with usual applied textures from default folders. Extension code: local extension = {} extension.textureField = nil extension.setTextureButton = nil extension.fixModelButton = nil extension.fixYField = nil extension.modelScale = 4.68042326 function extension.hook(event, extension) if event.id == EVENT_WIDGETACTION then if event.source == extension.setTextureButton then if (extension.textureField.text == "") then return end local texture = LoadTexture("/gfx/all.wad/" .. extension.textureField.text) --local texture = LoadTexture("/Materials/Developer/trigger.dds") local material = CreateMaterial() material:SetTexture(texture) local selected = program:GetSelection() for n = 1, #selected do local currentBrush = Brush(selected[n].entity) if currentBrush ~= nil then currentBrush:SetMaterial(material) currentBrush:Build() Print("Seted texture to selected brush "..extension.textureField.text) end end elseif event.source == extension.fixModelButton then local selected = program:GetSelection() for n = 1, #selected do local currentModel = Model(selected[n].entity) if currentModel ~= nil then local entityName = currentModel.name Print("Fixed Quake model: " ..entityName) local fixY = extension.fixYField.text if fixY == "" then fixY = 0.02 end if (entityName == "Marine" or entityName == "Grunt") then fixY = 0.02 elseif (entityName == "Rottweiler") then fixY = 0.1 end currentModel = fixQuakeModelCenter(currentModel, fixY) end end end end end -------------------------------------------------------------------- -- Add extension tab -------------------------------------------------------------------- local sidePanel = program.sidepanel if sidePanel ~= nil then sidePanel:AddItem("QtExt") local sz = program.sidepanel:ClientSize() local panel = CreatePanel(0, 0, sz.x, sz.y, program.sidepanel) local uiY = 20; local label1 = CreateLabel("Wad texture name", 32, uiY, 120, 30, panel) uiY = uiY + 32; extension.textureField = CreateTextField(20, uiY, sz.x - 40, 32, panel) uiY = uiY + 20 + 32; extension.setTextureButton = CreateButton("Set a wad texture to selected brush", 20, uiY, sz.x - 40, 32, panel) uiY = uiY + 20 + 32; local label2 = CreateLabel("Height offset", 32, uiY, 120, 30, panel) uiY = uiY + 32; extension.fixYField = CreateTextField(20, uiY, sz.x - 40, 32, panel) uiY = uiY + 20 + 32; extension.fixModelButton = CreateButton("Fix selected Quake models", 20, uiY, sz.x - 40, 32, panel) end ListenEvent(EVENT_WIDGETACTION, extension.setTextureButton, extension.hook, extension) ListenEvent(EVENT_WIDGETACTION, extension.fixModelButton, extension.hook, extension) function fixQuakeModelCenter(model, fixY) for i = 1, #model.lods do local lod = model.lods[i] for j = 1, #lod.meshes do local currentMesh = lod.meshes[j] currentMesh:Translate(-1 * currentMesh.bounds.center.x, -1 * currentMesh.bounds.center.y - fixY, -1 * currentMesh.bounds.center.z) end end model:UpdateBounds(); model:SetScale(extension.modelScale); return model; end
  13. You can reproduce it like SpiderPig suggested: It's very inconsistent tho. Sometimes few times in row and in another test attempts only 1 out of 10.
  14. I think searching does not work for 1-2 symbols only request
  15. When i'm trying to create Sprite with Pixmap texture it's invisible. Label and usual Sprites can be seen #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, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); auto light = CreateBoxLight(world); light->SetRange(-10, 10); light->SetRotation(15, 15, 0); light->SetColor(2); //Create camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -3); camera->SetFov(70); 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 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); auto label = CreateLabel("TEST GUI LABEL", 100, 100, 100, 50, ui->root); auto pixmap = CreatePixmap(iVec2(100, 100)); pixmap->Fill(Vec4(0.5f, 0.5f, 1, 1)); auto tex = CreateTexture(TEXTURE_2D, 100, 100, TEXTURE_RGBA, { pixmap }, 1, TEXTURE_CLAMP_UV); auto mtl = CreateMaterial(); mtl->SetTexture(tex); mtl->SetShadow(false); mtl->SetTransparent(true); mtl->SetShaderFamily(LoadShaderFamily("Shaders/WidgetBlock.fam")); //Create pixmap sprite auto sprite = CreateSprite(world, 0, 0); sprite->SetPosition(0, 0); // sprite->SetViewMode(SPRITEVIEW_BILLBOARD); sprite->SetMaterial(mtl); sprite->SetText("Test"); sprite->SetRenderLayers(2); //Create usual sprite auto sprite2 = CreateSprite(world, 2, 2); sprite2->SetPosition(2, 0, 0); sprite2->SetViewMode(SPRITEVIEW_BILLBOARD); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  16. Well, bottom clipping was fixed but suddenly there is still an issue if child widgets are at top #include "UltraEngine.h" using namespace UltraEngine; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> world; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<Widget> panel1; shared_ptr<Widget> panel2; shared_ptr<Widget> panel3; void initGui() { auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(world, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); 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); panel1 = CreatePanel(20, 200, 100, 100, ui->root); panel1->SetColor(1, 0, 0, 1, WIDGETCOLOR_BACKGROUND); panel2 = CreatePanel(50, -50, 100, 100, panel1); panel2->SetColor(0, 1, 0, 1, WIDGETCOLOR_BACKGROUND); panel3 = CreatePanel(25, -25, 100, 100, panel2); panel3->SetColor(0, 0, 1, 1, WIDGETCOLOR_BACKGROUND); } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 500, 500, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world world = CreateWorld(); world->SetAmbientLight(0); //Create a framebuffer framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0, 0, 0); initGui(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  17. Made an example without extra classes that imitate first version of inventory that Andy had when i looked into this case. 2 issues: 1. After Redraw() in real time top block overlap a block under it even if top is transparent or blue border in this example. 2. Some blocks change positions and sizes after Redraw() if those blocks were drawn initially, in this example it's text and background for text. First row is a widget with items and it looks fine until you hit space. Second initially without items. Space clears make two items for both widgets. After pressing Space: Second widget looks fine beside blue borders being filled square (issue 1). But first widget totally broken and have both issues. After redrawing with Space button: itemCount - to set how many items (red squares) suppose to show doHideBgId - hide text background for specific item. For some reason without it second issue does not happens. Maybe i missing something in a code. #include "UltraEngine.h" using namespace UltraEngine; class CustomWidget : public Panel { CustomWidget::CustomWidget() { cornerradius = 8; } protected: virtual bool Initialize(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent) { return Widget::Initialize(text, x, y, width, height, parent, style); } void Draw(const int x, const int y, const int width, const int height) { blocks.clear(); Vec4 color = Vec4(0.9, 0.9, 0.9, 0.3); int blockWidth = 100; for (int i = 0; i < 4; i++) { iVec2 pos; pos.x = i * blockWidth + i * 10; pos.y = 0; iVec2 blockSize(blockWidth); AddBlock(pos, blockSize, color); if (i < itemCount) { auto pm = CreatePixmap(50, 50); pm->Fill(Vec4(1, 0, 0, 1)); int block = AddBlock(pm, pos, Vec4(1)); blocks[block].size = blockSize; if (doHideBgId != i) AddBlock(iVec2(pos.x, pos.y + (blockSize.height - 18)), iVec2(blockSize.width, 18), Vec4(0.2f, 0.2f, 0.2f, 1)); AddBlock("item", iVec2(pos.x, pos.y + (blockSize.height - 15)), iVec2(blockSize.width, 15), Vec4(1)); } if (i != 0) { int block = AddBlock(pos, iVec2(blockSize.x, blockSize.y), Vec4(0, 0, 0, 1), true); blocks[block].wireframe = true; } else { int block = AddBlock(pos, iVec2(blockSize.x, blockSize.y), Vec4(0.16, 0.47, 1, 1), true); blocks[block].wireframe = true; } } } public: int itemCount = 0; int doHideBgId = 0; static shared_ptr<CustomWidget> create(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent) { struct Struct : public CustomWidget { }; auto instance = std::make_shared<Struct>(); instance->Initialize(x, y, width, height, parent); instance->SetColor(0, 1, 0, 1, WIDGETCOLOR_BACKGROUND); return instance; } }; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> menuWold; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<CustomWidget> customWidget; shared_ptr<CustomWidget> customWidget2; void initGui() { auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(menuWold, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(1.0f, 1.0f, 1.0f, 1.0f); uiCamera = CreateCamera(menuWold, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0); uiCamera->SetRenderLayers(2); uiCamera->SetClearMode(CLEAR_DEPTH); customWidget = CustomWidget::create(10, 10, 500, 120, ui->root); customWidget->itemCount = 2; customWidget2 = CustomWidget::create(10, 150, 500, 120, ui->root); } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 500, 300, displays[0], WINDOW_DEFAULT); //Create a world menuWold = CreateWorld(); //Create a framebuffer framebuffer = CreateFramebuffer(window); auto textureLoaderPlugin = LoadPlugin("Plugins/FITextureLoader"); initGui(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE)) { customWidget->itemCount = 2; customWidget->doHideBgId = -1; customWidget->Redraw(); customWidget2->itemCount = 2; customWidget2->doHideBgId = -1; customWidget2->Redraw(); } menuWold->Update(); menuWold->Render(framebuffer); } return 0; }
  18. { "component": { "properties": [ { "name": "teamId", "label": "Team id", "value": 2 }, { "name": "health", "label": "Health", "value": 10 }, { "name": "textureName", "label": "Texture", "value": "city4_2" } ] } } Same problem with default component if i move it to same folder
  19. If i enter new value in text field of custom component, click at other entity and click back on entity with my component its string value is default from json. Int fields works fine.
  20. Resolved this issue with Josh help via AddMod(quakepath) which "adds another folder and makes the engine think that folder is in the current dir"
  21. In 2D seems to be still working: But in 3D: #include "UltraEngine.h" using namespace UltraEngine; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> world; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<Widget> panel1; shared_ptr<Widget> panel2; shared_ptr<Widget> panel3; void initGui() { auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(world, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); 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); panel1 = CreatePanel(20, 20, 100, 100, ui->root); panel1->SetColor(1, 0, 0, 1, WIDGETCOLOR_BACKGROUND); panel2 = CreatePanel(50, 50, 100, 100, panel1); panel2->SetColor(0, 1, 0, 1, WIDGETCOLOR_BACKGROUND); panel3 = CreatePanel(25, 25, 100, 100, panel2); panel3->SetColor(0, 0, 1, 1, WIDGETCOLOR_BACKGROUND); } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 300, 300, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world world = CreateWorld(); world->SetAmbientLight(0); //Create a framebuffer framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0, 0, 0); initGui(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  22. If i drag or create window at 2nd screen ui is looks broken, button can be pressed tho. Also if i try to create full window at non main display it's still appears on main one. Editor UI works fine on all displays. Main screen: Second screen: Third screen: #include "UltraEngine.h" using namespace UltraEngine; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> menuWold; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<Widget> btn; shared_ptr<Widget> btn2; bool fullscreen = false; int displayId = 0; void initGui() { auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(menuWold, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); uiCamera = CreateCamera(menuWold, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0); uiCamera->SetRenderLayers(2); uiCamera->SetClearMode(CLEAR_DEPTH); btn = CreateButton("Change display", (float)framebuffer->GetSize().x / 2, framebuffer->GetSize().y / 2, 200, 200, ui->root); btn->SetFontScale(2.0f); btn2 = CreateButton("Fullscreen", (float)framebuffer->GetSize().x / 2, framebuffer->GetSize().y / 2 - 100, 120, 30, ui->root, BUTTON_CHECKBOX); if (fullscreen) btn2->SetState(WIDGETSTATE_SELECTED); } void changeDisplay() { auto displays = GetDisplays(); displayId = ++displayId; if (displayId == displays.size()) { displayId = 0; } if (!fullscreen) { window = CreateWindow("Ultra Engine", 0, 0, 1000, 1000, GetDisplays()[displayId], WINDOW_DEFAULT); } else { window = CreateWindow("Ultra Engine", 0, 0, displays[displayId]->GetSize().width, displays[displayId]->GetSize().height, displays[displayId], WINDOW_DEFAULT | WINDOW_FULLSCREEN); } framebuffer = CreateFramebuffer(window); initGui(); } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 1000, 1000, displays[0], WINDOW_DEFAULT); //Create a world menuWold = CreateWorld(); //Create a framebuffer framebuffer = CreateFramebuffer(window); //Create light auto light = CreateBoxLight(menuWold); light->SetRange(-10, 10); light->SetRotation(15, 15, 0); light->SetColor(2); //Create camera auto camera = CreateCamera(menuWold); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -3); camera->SetFov(70); //Create scenery auto box = CreateBox(menuWold); initGui(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { while (PeekEvent()) { const Event ev = WaitEvent(); if (ev.source == btn && ev.id == EVENT_WIDGETACTION) { changeDisplay(); } if (ev.source == btn2 && ev.id == EVENT_WIDGETACTION) { fullscreen = !fullscreen; } ui->ProcessEvent(ev); } menuWold->Update(); menuWold->Render(framebuffer); } return 0; }
  23. After resizing icon of yellow armor becomes a blue one. Red also becomes blue. Green stays green. Used to be fine several months ago. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> world; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<Widget> panel; shared_ptr<Widget> panel2; bool isFirst = true; void initGui() { auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(world, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); 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); panel = CreatePanel(10, 10, 50, 50, ui->root, PANEL_DEFAULT); panel2 = CreatePanel(10, 70, 100, 100, ui->root, PANEL_DEFAULT); auto pixmap = LoadPixmap("/gfx/items.wad/armor2");//yellow armor panel->SetPixmap(pixmap); auto pixmap2 = pixmap->Resize(pixmap->size.x * 1.5f, pixmap->size.y * 1.5f);//blue now O_o panel2->SetPixmap(pixmap2); } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 300, 300, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world world = CreateWorld(); world->SetAmbientLight(0); //Create a framebuffer 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); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0, 0, 0); camera->Move(0, 0, -0.3); camera->SetRange(0.01, 100); camera->SetFov(70); initGui(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  24. Yes, i did check in my own component, just simplified it here. It's just an example for model that start map has. I don't use ThirdPersonControls or player physics mode in my project. Just wanted to apply a collision in Start om my units component. Have no problem with doing that outside of component while taking entities from world.
×
×
  • Create New...