-
Posts
516 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Dreikblack
-
#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; }
-
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); }
-
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; }
-
use_count() in smart_ptr<Window> increments with each input event
Dreikblack replied to Lupin's topic in Bug Reports
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; } -
In loaded map a brush does not have saved texture
Dreikblack replied to Dreikblack's topic in Bug Reports
Uploaded what i got with this code just in casegame.zip -
In loaded map a brush does not have saved texture
Dreikblack replied to Dreikblack's topic in Bug Reports
I create a map in code of this example. -
In custom widget cornerradius does not make cornes rounded
Dreikblack replied to Dreikblack's topic in Bug Reports
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. -
Working again on Quake Tactics since Steam release. Changes i did before beta sub ended: - Reworked Unit panel with new stats icons and added character icon that changes when marine getting a hit. - Added hot keys. Space and enter to confirm actions and ESC with RMB to cancel. - Icons for weapons and backpack from Quake. Have no idea why yellow armor is blue now after Steam release Changes after Steam release: - Remade a font so only capital letters are now like Quake font. - New cursor. - Sounds now tied to unit positions. - Switched to editor map except units due problem with Quake models so i keep spawning units via game code with coords from json file.
-
Editor saves Quake models as: "package": "pak0.pak", "path": "progs/player.mdl" But if game loads a pak0 from not a game folder model is not being loaded. if i change manually to "path": "C:/Program Files (x86)/Steam/steamapps/common/Quake/rerelease/id1/progs/player.mdl" editor can't load a model. I can't find a proper way to edit .ultra map in code. stream->ReadWString() returns hieroglyphs from a map. What's a best approach to make Quake models loads in Editor and in a game?
-
I have a same issue in beta branch. Happens usually when i drag a brush in a top view. GPU - RTX 4080.
-
I don't know if it was changed intentionally somehow but several months ago blocks[0].radius used to make corners rounded #include "UltraEngine.h" using namespace UltraEngine; class CustomWidget : public Panel { CustomWidget::CustomWidget() { cornerradius = 8; blocks.resize(1); } 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[0].color = color[WIDGETCOLOR_BACKGROUND]; blocks[0].wireframe = false; blocks[0].position = iVec2(0); blocks[0].size = size; blocks[0].hidden = false; blocks[0].radius = cornerradius; } public: 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.5, 0.5, 0.5, 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; 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); customWidget = CustomWidget::create(10, 50, 200, 50, ui->root); } 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_DEFAULT); //Create a world menuWold = CreateWorld(); //Create a framebuffer framebuffer = CreateFramebuffer(window); //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) { menuWold->Update(); menuWold->Render(framebuffer); } return 0; }
-
1. Create brush and material. 2. Apply texture to material: Saved locally this texture for test purpose https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/tiles.dds 3. Save a map with a brush. 4. Load map - no texture on brush. I can see it in a map file with a text editor. #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); //Load FreeImage plugin auto plg = LoadPlugin("Plugins/FITextureLoader"); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 1, -4); //Create light auto light = CreateBoxLight(world); light->SetRange(-10, 10); light->SetArea(15, 15); light->SetRotation(45, 35, 0); light->SetColor(2); //Create a scene auto scene = CreateMap(); scene->entities.push_back(camera); scene->entities.push_back(light); //Load model auto t = CreateBoxBrush(world, 1, 1, 1); auto texture = LoadTexture("tiles.dds"); auto material = CreateMaterial(); material->SetTexture(texture); t->SetMaterial(material); scene->entities.push_back(t); scene->Save("game.sav"); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE)) { scene = LoadMap(world, "game.sav"); } world->Update(); world->Render(framebuffer); } return 0; }
-
Pretty sure OP meant that https://en.m.wikipedia.org/wiki/Entity_component_system
-
Like many already said holding a mouse button is not a convenient to create an objects. Maybe creation should have an own tool mode to avoid unwanted actions so it would be just one click to create. Object select probably should open map tab. Which probably should be Scene tab. Copy pasting objects should also copy components and properties. atm it would be a pain o do make tile based levels for tactics in the editor for example. Selection could be an own tool mode so user could able to select a few objects by holding LMB without doing anything else at same time (idk how to call it, same thing that you use on Windows folder to select few files). Objects tab is not very user friendly in general - 4 clicks to select one specific object. I would try tabs or icon button row for categories (like toolbar). Probably same for objects. Primitive should have more parameters for creation - optionally position and size. atm i don't even known how to create a brush with specific size since even there is no size even in properties in a map tab. Menu component should not close it self if you click on button that do nothing but shows other buttons (like Recent Files). Tool tip is needed for some buttons and properties so user would know what they do without looking into documentation. Scripting needs at least basic documentation with things (components names etc.) that you can refer in own scripts and an example how to spawn objects in a editor scene. Terrain misses a cut tool to make a holes in it. The editor should open last map at start. Also it should ask about saving changes when you have them while closing the editor.
-
Try to remove this include and add: class MouseMovementController; above class CollectWaterTask : public Component
-
I'm just use class name instead of this to assign a value like this: void setTileMap(map<iVec3, shared_ptr<Tile>> tileMap) { Unit::tileMap = tileMap; } But in your case you don''t need neither. I don't see a reason why you have a null pointer issue here but when you have no overlapping vars with same name you can just do: taskStarted = true; btw all my components atm are hpp. I will rework them into .h and .cpp later but maybe that a reason? In beta with precompiler for a components .hpp was the only option.
-
I'm not sure if there is a any difference but try GatherWaterTask::taskStarted = true;
-
Playing sounds simultaneously causes a crash when last sounds stop playing. Happens if world created and rendered. When i tried to do it with no world, only one sound played and no crash happened. Steam beta branch. Several months ago had no such problem. #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, 300, 300, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Load FreeImage plugin auto sound = LoadSound("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Sound/notification.wav"); int i = 0; //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (i < 10) { sound->Play(); i++; } world->Update(); world->Render(framebuffer); } return 0; }
-
Actually i just missed a folder in a path. I thought it would crash if cursor would be null so i did not even tried to debug it
-
My cursor is just invisible after changing. Tested it on rotate.cur from engine folder as well. #ifdef _WIN32 WString path = AppDir() + "/UI/Icons/Cursor.cur"; auto cursor = LoadCursorFromFileW(path.c_str()); ActiveWindow()->SetCursor(cursor); #endif
-
Steam beta branch. When i first time create widgets it's works. But when i destroy them and create new ones in a same vector they are invisible. It worked several months ago. Need that for an inventory gui. #include "UltraEngine.h" using namespace UltraEngine; class ContainerWidget : public Panel { vector<shared_ptr<Widget>> btns; protected: virtual bool Initialize(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent) { btns.resize(4); return Widget::Initialize(text, x, y, width, height, parent, style); } public: void initBtns() { clearBtns(); for (int i = 0; i < btns.size(); i++) { btns[i] = CreateButton("Btn", i * 50 + 10, 0, 20, 20, Self()->As<Widget>()); } } void clearBtns() { for (int i = 0; i < btns.size(); i++) { if (btns[i]) { btns[i]->SetParent(nullptr); btns[i] = nullptr; } } } static shared_ptr<ContainerWidget> create(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent) { struct Struct : public ContainerWidget { }; auto instance = std::make_shared<Struct>(); instance->Initialize(x, y, width, height, parent); instance->SetColor(0.5, 0.5, 0.5, 1, WIDGETCOLOR_BACKGROUND); instance->initBtns(); return instance; } }; 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<ContainerWidget> container; 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); container = ContainerWidget::create(10, 50, 200, 50, ui->root); btn = CreateButton("Reinit buttons", 10, 10, 150, 20, ui->root); } 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_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) { while (PeekEvent()) { const Event ev = WaitEvent(); if (ev.source == btn && ev.id == EVENT_WIDGETACTION) { container->initBtns(); } ui->ProcessEvent(ev); } menuWold->Update(); menuWold->Render(framebuffer); } return 0; }