Jump to content

Dreikblack

Members
  • Posts

    664
  • Joined

  • Last visited

Everything posted by Dreikblack

  1. Still same issue for me after another update
  2. I guess something changed in last updates? Was not updating because it could break something again XD
  3. Strange. I even copy-pasted my code from a message two posts above just to mask sure:
  4. camera->SetBackfaceCulling(1); does nothing in my case and with 0 argument another triangle also became darker Brush with same shape worked fine btw without extra culling settings.
  5. Made it work but i have strange triangle at bottom #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 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(0, 0, -1); //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 = 4, height = 2, length = 6; 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(0, 1, 2);//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(1, 3, 4); //"face" mesh->AddPrimitive(1, 4, 2); //"face" mesh->AddPrimitive(2, 4, 0); //"right" model->SetColor(0.5f, 0.8f, 0, 0.25f); auto& mat = unlitMaterial; mat->SetTransparent(true); model->SetMaterial(mat); auto collider = CreateConvexHullCollider(model); model->SetCollider(collider); auto modelLine = CreateModel(world); auto meshLine = modelLine->AddMesh(MESH_LINES); meshLine->AddVertex(0, 0, 0); //S meshLine->AddVertex(-width * 0.5, -height * 0.5, length);//NW meshLine->AddVertex(width * 0.5, -height * 0.5, length);//NE meshLine->AddPrimitive(0, 1);//S , NW, NE meshLine->AddPrimitive(1, 2);//S , NW, NE meshLine->AddPrimitive(0, 2);//S , NW, NE meshLine->AddVertex(-width * 0.5, height * 0.5, length);//NW h meshLine->AddVertex(width * 0.5, height * 0.5, length);//NE h meshLine->AddPrimitive(0, 3);//S , NW h, NE h meshLine->AddPrimitive(3, 4);//S , NW h, NE h meshLine->AddPrimitive(0, 4);//S , NW h, NE h meshLine->AddPrimitive(0, 1);//left meshLine->AddPrimitive(1, 3);//left meshLine->AddPrimitive(0, 3);//left meshLine->AddPrimitive(1, 2); //"face" meshLine->AddPrimitive(2, 4); //"face" meshLine->AddPrimitive(4, 3); //"face" meshLine->AddPrimitive(1, 3); //"face" meshLine->AddPrimitive(2, 4); //"right" meshLine->AddPrimitive(4, 0); //"right" meshLine->AddPrimitive(2, 0); //"right" //Finalize the brush modelLine->SetColor(0, 0, 0, 1); auto matLine = unlitMaterial; matLine->SetLineStipple(LINE_STIPPLE_DASHED); modelLine->SetMaterial(matLine); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  6. Tried even set it to MESH_QUADS, but now it crahses at mesh->AddPrimitive(0, 1, 2); Should it really always match each other?
  7. It was in usual mesh code. Anyway after changing it still keep happening at 53rd line - mesh->AddPrimitive(1, 2);
  8. Happens on mesh->AddPrimitive(1, 2, 4, 3); (54 line) Trying to remake tetrahedron as a model here. #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 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(0, 0, -2); //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 = 4, height = 2, length = 6; 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(0, 1, 2);//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(1, 2); //"face" mesh->AddPrimitive(2, 4); //"face" mesh->AddPrimitive(4, 3); //"face" mesh->AddPrimitive(1, 3); //"face" mesh->AddPrimitive(2, 4, 0); //"right" model->SetColor(0.5f, 0.8f, 0, 0.25f); auto& mat = unlitMaterial; mat->SetTransparent(true); model->SetMaterial(mat); auto collider = CreateConvexHullCollider(model); model->SetCollider(collider); auto modelLine = CreateModel(world); auto meshLine = modelLine->AddMesh(MESH_LINES); meshLine->AddVertex(0, 0, 0); //S meshLine->AddVertex(-width * 0.5, -height * 0.5, length);//NW meshLine->AddVertex(width * 0.5, -height * 0.5, length);//NE meshLine->AddPrimitive(0, 1, 2);//S , NW, NE meshLine->AddVertex(-width * 0.5, height * 0.5, length);//NW h meshLine->AddVertex(width * 0.5, height * 0.5, length);//NE h meshLine->AddPrimitive(0, 3);//S , NW h, NE h meshLine->AddPrimitive(3, 4);//S , NW h, NE h meshLine->AddPrimitive(0, 4);//S , NW h, NE h meshLine->AddPrimitive(0, 1);//left meshLine->AddPrimitive(1, 3);//left meshLine->AddPrimitive(0, 3);//left meshLine->AddPrimitive(1, 2); //"face" meshLine->AddPrimitive(2, 4); //"face" meshLine->AddPrimitive(4, 3); //"face" meshLine->AddPrimitive(1, 3); //"face" meshLine->AddPrimitive(2, 4, 0); //"right" //Finalize the brush modelLine->SetColor(0.5f, 0.8f, 0, 0.25f); auto matLine = unlitMaterial; matLine->SetLineStipple(LINE_STIPPLE_DASHED); modelLine->SetMaterial(matLine); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  9. Can you share a little example for SetLineStipple()? Not for UI but just something simple where stipple effect could be seen.
  10. I mostly finished basic core gameplay and GUI. - Changed available tiles look from outline to square unlit brushes - Added a nailgun that can shoot through armor multiply times at once with new number field next to Ok button. - Added an action properties row in an action dialog (action point cost, damage, distance etc.) - Added knockback for shotguns at close distance - Added spread for shotgun - multiply enemies can be shot - Added block and dodge system - action points (yellow) wastes at point blank distance for blocking and movement (blue) uses for dodges. - After death units became corpses - Corpses and alive units can be gibbed (to free tile) if enough damage was dealt to them - How much health, armor, action or movement points will be wasted after or shot or move now shows by blinking in unit bars (above units) - Yellow lines shows which targets in lines of sights for current weapon - Inventory - for equipping weapon, armor etc. from marine common inventory - Marine bars at left side with their status and ability to select one those marines - Added obstacles that can be used as covers and can be destroyed idk why sound is broken in the video, game sounds normal while playing.
  11. Thanks! It works and even alpha channel working! Maybe i should try to rework other widgets like that for temp fix of black background
  12. I think block.SetPixmap work fine if a pixmap as member set in but with if it's another pixmap (to make few different icons for different blocks) i have an exception at Render(). An example: #include "UltraEngine.h" using namespace UltraEngine; class NewWidget : public Widget { protected: virtual void Draw(const int x, const int y, const int width, const int height) { for (int i = 0; i < 4; i++) { blocks[i].hidden = false; blocks[i].position = iVec2(i * 64, 0); blocks[i].size = iVec2(64, 64); blocks[i].filter = pixmapfilter; blocks[i].color = Vec4(1); auto px = LoadPixmap("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/dirt01.dds"); blocks[i].SetPixmap(px); } } public: static shared_ptr<NewWidget> create(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent, const int style = 0) { struct Struct : public NewWidget { }; auto instance = std::make_shared<Struct>(); instance->Initialize("", x, y, width, height, parent, style); return instance; } NewWidget() { blocks.resize(4); } }; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1920, 1080, 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.6); camera->SetFov(90); camera->SetRotation(54.736f, 45, 0); camera->SetPosition(0, 4, 0); auto sz = framebuffer->GetSize(); // 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 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 widget = NewWidget::create(0, 0, 64 * 4, 64, ui->root, 0); //Create light auto light = CreateBoxLight(world); light->SetRange(-100, 100); light->SetArea(100, 100); light->SetRotation(35, 35, 0); light->SetColor(2); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer, false); } return 0; }
  13. My inventory is a bit similar to yours (3 sections with labels)
  14. I don't know if i can do sync manually in another way but there is no warn button to do it (just green check symbol)
  15. GUI background used to be transparent with: ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f);
  16. Example: #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, 1920, 1080, 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.6); camera->SetFov(90); camera->SetRotation(54.736f, 45, 0); camera->SetPosition(0, 4, 0); auto sz = framebuffer->GetSize(); // 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 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); //Create light auto light = CreateBoxLight(world); light->SetRange(-100, 100); light->SetArea(100, 100); light->SetRotation(35, 35, 0); light->SetColor(2); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer, false); } return 0; }
  17. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0]); //Create framebuffer auto framebuffer = CreateFramebuffer(window); //Create world auto world = CreateWorld(); //Load a font auto font = LoadFont("Fonts/arial.ttf"); //Create user interface auto ui = CreateInterface(world, font, framebuffer->size); //Create widget iVec2 sz = ui->root->ClientSize(); auto button = CreateButton("Button", sz.x / 2 - 75, sz.y / 2 - 15, 150, 30, ui->root); auto plg = LoadPlugin("Plugins/FITextureLoader"); auto quakeLoaderPlugin = LoadPlugin("Plugins/QuakeLoader"); //Load model WString path = AppDir(); auto pak = LoadPackage(path + "/PAK0.PAK"); ChangeDir(path); auto pixmap = LoadPixmap("gfx/bigbox.lmp"); button->SetPixmap(pixmap); //Create camera auto camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); camera->SetPosition(framebuffer->size.x / 2, framebuffer->size.y / 2, 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; }
×
×
  • Create New...