Jump to content

Dreikblack

Members
  • Posts

    331
  • Joined

  • Last visited

Everything posted by Dreikblack

  1. 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.
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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.
  7. I think searching does not work for 1-2 symbols only request
  8. 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; }
  9. 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; }
  10. 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; }
  11. { "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
  12. 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.
  13. 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"
  14. 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; }
  15. 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; }
  16. 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; }
  17. 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.
  18. #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> panel; shared_ptr<Icon> icon1; shared_ptr<Icon> icon2; bool isFirst = true; 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); panel = CreatePanel(10, 50, 64, 64, ui->root, PANEL_DEFAULT); icon1 = LoadIcon("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Icons/help.svg"); icon2 = LoadIcon("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Icons/new.svg"); panel->SetIcon(icon1); } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 200, 200, 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); initGui(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { isFirst = !isFirst; if (isFirst) { panel->SetIcon(icon1); } else { panel->SetIcon(icon2); } menuWold->Update(); menuWold->Render(framebuffer); } return 0; }
  19. For example in ThirdPersonControls virtual void Start() { smoothcameradistance = followdistance; auto entity = GetEntity(); entity->SetPhysicsMode(PHYSICS_PLAYER); if (entity->GetMass() == 0.0f) entity->SetMass(78); entity->SetCollisionType(COLLISION_PLAYER); //here auto collider = CreateMeshCollider(entity->As<Model>()); if (collider) entity->SetCollider(collider); camera = CreateCamera(entity->GetWorld()); camera->SetPosition(0, eyeheight, 0); camera->SetRotation(0, 0, 0); camera->SetFov(70); currentcameraposition = camera->GetPosition(true); freelookrotation = entity->GetRotation(true); }
  20. I'm not sure what's exact conditions when it does not work but manage to reproduce it when model with detection collider is a green in debug before target brush moves beside its area and in a release is a red (not detecting) 90% of time in same conditions when it should be a green. btw i don't know why model is not transparent. Somehow it's still working in my game but not in example. #include "UltraEngine.h" #include "ComponentSystem.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, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.8); camera->Turn(35, 0, 0); camera->Move(2, 0, -2); camera->SetRefraction(true); //Create light auto light = CreateBoxLight(world); light->SetRange(-20, 20); light->SetArea(20, 20); light->SetRotation(35, 35, 0); auto unlitMaterial = CreateMaterial(); auto unlitShader = LoadShaderFamily("Shaders/Unlit.json"); unlitMaterial->SetShaderFamily(unlitShader); int width = 2, height = 1, length = 3; auto model = CreateModel(world); auto mesh = model->AddMesh(); mesh->AddVertex(0, 0, 0); //S mesh->AddVertex(-width * 0.5, -height * 0.5, length);//NW mesh->AddVertex(width * 0.5, -height * 0.5, length);//NE mesh->AddPrimitive(2, 1, 0);//S , NW, NE mesh->AddVertex(-width * 0.5, height * 0.5, length);//NW h mesh->AddVertex(width * 0.5, height * 0.5, length);//NE h mesh->AddPrimitive(0, 3, 4);//S , NW h, NE h mesh->AddPrimitive(0, 1, 3);//left mesh->AddPrimitive(4, 3, 1); //"face" mesh->AddPrimitive(2, 4, 1); //"face" mesh->AddPrimitive(0, 4, 2); //"right" auto& mat = unlitMaterial; mat->SetTransparent(true); model->SetMaterial(mat); model->SetColor(0.5f, 0.8f, 0, 0.25f); model->SetPosition(0, 0, 0); auto collider = CreateConvexHullCollider(mesh); model->SetCollider(collider); Vec3 targetPos(0, 0, 0); auto box = CreateBox(world, 0.1f); box->SetPosition(targetPos); auto mover = box->AddComponent<Mover>(); mover->movementspeed.x = 1.5f; model->Turn(0, 90, 0); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { targetPos = box->GetPosition(); auto newTargetPos = TransformPoint(targetPos, NULL, model); bool isInside = model->GetCollider()->IntersectsPoint(newTargetPos); if (isInside) { model->SetColor(0, 1, 0, 1); } else { model->SetColor(1, 0, 0, 1); } world->Update(); world->Render(framebuffer); } return 0; }
  21. It's still at least 5 counts after FlushEvents(); I'm not sure if it's related but old window still open after creating a new window even if i use a window->Close(); It was working for me in a beta several months ago even without Close(). #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, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyDown(KEY_SPACE)) { FlushEvents(); } if (window->KeyDown(KEY_C)) { window->Close(); } if (window->KeyDown(KEY_E)) { window->Close(); window = CreateWindow("Quake Tactics", 0, 0, 720, 480, GetDisplays()[0], WINDOW_TITLEBAR | WINDOW_CENTER); framebuffer = CreateFramebuffer(window); } window->SetText(WString(window.use_count())); world->Update(); world->Render(framebuffer); } return 0; }
  22. Uploaded what i got with this code just in casegame.zip
  23. For now i resolved it by drawing a pixmap for a background. Had these widgets before but switched to block based widgets due bug that was fixed later.
×
×
  • Create New...