-
Posts
538 -
Joined
-
Last visited
Community Answers
-
Dreikblack's post in Fade In (Lua) was marked as the answer
Reworked component to make it work with sprite:
FadeIn = { duration = 5.0, -- Dauer des Fade-In in Sekunden elapsed = 0, -- Verstrichene Zeit isActive = true, -- Status des Fade-In framebuffer = nil, -- Framebuffer für die Größe orthographicCamera = nil, -- 2D camera fadeSprite = nill --Sprite that covering camera fully } function FadeIn:Start() -- Sicherstellen, dass der Framebuffer und das Fenster initialisiert sind if not self.framebuffer then self.framebuffer = CreateFramebuffer(ActiveWindow()) -- Framebuffer erstellen print("Framebuffer erstellt!") -- Debugging-Ausgabe end local world = self.entity:GetWorld() local sz = self.framebuffer.size self.orthographicCamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC) self.orthographicCamera:SetClearMode(CLEAR_DEPTH); self.orthographicCamera:SetClearColor(0.125) self.orthographicCamera:SetPosition(sz.x * 0.5, sz.y * 0.5, 0.0) self.orthographicCamera:SetRenderLayers(2) self.fadeSprite = CreateSprite(world, sz.x, sz.y) self.fadeSprite:SetRenderLayers(2) local material = CreateMaterial() material:SetShadow(false); material:SetTransparent(true); material:SetShaderFamily(LoadShaderFamily("Shaders/Unlit.fam")); self.fadeSprite:SetMaterial(material) self.fadeSprite:SetColor(0, 0, 0, 1) -- Vollständig schwarz self.elapsed = 0 self.isActive = true -- Fade-In-Prozess aktivieren print("Fade-In gestartet!") -- Debugging-Ausgabe end function FadeIn:ProcessEvent(ev) end function FadeIn:Update() if not self.isActive or not self.fadeSprite then print("Fade-In-Prozess ist nicht aktiv oder Sprite fehlt.") -- Debugging-Ausgabe return end local step = 0.016 -- Zeit aktualisieren self.elapsed = self.elapsed + step if self.elapsed < self.duration then -- Alpha-Wert basierend auf der verstrichenen Zeit berechnen local alpha = math.max(0, 1 - self.elapsed / self.duration) self.fadeSprite:SetColor(0, 0, 0, alpha) else -- Fade-In abgeschlossen, Sprite entfernen self.fadeSprite:SetHidden(true) self.fadeSprite = nil self.isActive = false print("Fade-In abgeschlossen.") -- Debugging-Ausgabe end end RegisterComponent("FadeIn", FadeIn) return FadeIn
-
Dreikblack's post in Splitscreen was marked as the answer
Yes, at least in Ultra, idk about Leadwerks. Made a simple 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, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); auto sz = framebuffer->GetSize(); //Create camera auto camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); camera->SetPosition(sz.x * 0.5f, sz.y * 0.5f, 0); camera->SetClearMode(CLEAR_DEPTH); auto leftSprite = CreateSprite(world, sz.x / 2, sz.y); auto rightSprite = CreateSprite(world, sz.x / 2, sz.y); rightSprite->SetPosition(sz.x / 2, 0); auto unlitShader = LoadShaderFamily("Shaders/Unlit.fam"); auto leftMaterial = CreateMaterial(); leftMaterial->SetShaderFamily(unlitShader); leftMaterial->SetTransparent(true); auto leftTextureBuffer = CreateTextureBuffer(sz.x / 2, sz.y); leftMaterial->SetTexture(leftTextureBuffer->GetColorAttachment()); leftSprite->SetMaterial(leftMaterial); leftSprite->SetShadows(false); auto leftCamera = CreateCamera(world); leftCamera->SetFov(90); leftCamera->SetRenderTarget(leftTextureBuffer); leftCamera->SetMatrix(camera->matrix); auto rightMaterial = CreateMaterial(); rightMaterial->SetShaderFamily(unlitShader); rightMaterial->SetTransparent(true); auto rightTextureBuffer = CreateTextureBuffer(sz.x / 2, sz.y); rightMaterial->SetTexture(rightTextureBuffer->GetColorAttachment()); rightSprite->SetMaterial(rightMaterial); rightSprite->SetShadows(false); auto rightCamera = CreateCamera(world); rightCamera->SetFov(90); rightCamera->SetRenderTarget(rightTextureBuffer); //Create scenery //Create light auto light = CreateBoxLight(world); light->SetRange(-10, 10); light->SetRotation(15, 15, 0); light->SetColor(2); auto box = CreateBox(world); auto cone = CreateCone(world); cone->SetPosition(1.25, 0, 0); cone->SetColor(0, 0, 1); auto sphere = CreateSphere(world); sphere->SetPosition(-1.25, 0, 0); sphere->SetColor(1, 0, 0); leftCamera->SetPosition(0, 0, -3); rightCamera->SetPosition(1, 0, -5); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
-
Dreikblack's post in Double click method is not called was marked as the answer
Found out that i was my fault - my widget for buttons was making selected button non interactive and i forgot about that
-
Dreikblack's post in Light with Component (Lua) was marked as the answer
You need to cast self.entity to light,
Something like:
local light = (Light)self.entity self.currentRange = light:GetRange() -
Dreikblack's post in Scaling camera physics to enter rooms was marked as the answer
afaik player size params not added yet
-
Dreikblack's post in Prefab children at wrong places at map was marked as the answer
In the editor seems so, waiting for full update to be sure.
-
Dreikblack's post in 0.9.7 Editor wont start was marked as the answer
Try to delete or rename your %programdata%\Ultra Engine\settings.json.
-
Dreikblack's post in How to make entities in editor not being instances? was marked as the answer
void MakeModelUnique(shared_ptr<Model> model) { vector<shared_ptr<Mesh>> copiedMeshes; for (auto& lod : model->lods) { for (auto& mesh : lod->meshes) { copiedMeshes.push_back(mesh->Copy()); break; } } model->Clear(); for (auto& mesh : copiedMeshes) { model->AddMesh(mesh); } }
-
Dreikblack's post in Resaving a map in editor removes materials that were applied via script was marked as the answer
No longer relevant - saving now materials after creating as mat files
-
Dreikblack's post in How to save depth with object rendered with extra camera? was marked as the answer
Final working example:
#include "UltraEngine.h" #include "ComponentSystem.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 sz = framebuffer->GetSize(); int MAIN_LAYER = 1, OUTPUT_LAYER = 2, EXTRA_LAYER = 4, EXTRA_OUTPUT_LAYER = 8; auto light = CreateBoxLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); auto backBox = CreateBox(world, 5); backBox->SetPosition(0, 0, 7); backBox->SetColor(0, 1, 0, 1); auto betweenBox = CreateBox(world); betweenBox->SetRenderLayers(EXTRA_LAYER); betweenBox->SetColor(1, 0, 0, 1); auto unlitShader = LoadShaderFamily("Shaders/Unlit.fam"); auto boxMat = CreateMaterial(); boxMat->SetShaderFamily(unlitShader); betweenBox->SetMaterial(boxMat); auto betweenBox2 = CreateBox(world); betweenBox2->SetPosition(0.5, 0.5, 0); betweenBox2->SetRenderLayers(EXTRA_LAYER); betweenBox2->SetColor(1, 0, 0, 1); betweenBox2->SetMaterial(boxMat); auto frontBox = CreateBox(world, 1); frontBox->SetPosition(-0.5, 0, -0.5); frontBox->SetColor(1, 1, 0, 1); auto mainCameraInput = CreateCamera(world); mainCameraInput->SetPosition(0, 0, -3); mainCameraInput->SetRenderLayers(MAIN_LAYER); auto mainTextureBuffer = CreateTextureBuffer(sz.x, sz.y); mainCameraInput->SetRenderTarget(mainTextureBuffer); auto mainSprite = CreateSprite(world, sz.x, sz.y); mainSprite->SetRenderLayers(OUTPUT_LAYER); auto mainMaterial = CreateMaterial(); mainMaterial->SetShaderFamily(unlitShader); mainSprite->SetMaterial(mainMaterial); mainMaterial->SetTexture(mainTextureBuffer->GetColorAttachment()); auto mainCameraOutput = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); mainCameraOutput->SetPosition(sz.x * 0.5f, sz.y * 0.5f, 0); mainCameraOutput->SetRenderLayers(OUTPUT_LAYER); mainCameraOutput->SetLighting(false); mainCameraOutput->SetClearMode(CLEAR_DEPTH); //red transporent boxes render part auto extraCameraInput = CreateCamera(world); extraCameraInput->SetPosition(0, 0, -3); extraCameraInput->SetRenderLayers(EXTRA_LAYER); extraCameraInput->SetMatrix(mainCameraInput->matrix); extraCameraInput->SetClearMode(CLEAR_COLOR); extraCameraInput->SetLighting(false); auto extraTextureBuffer = CreateTextureBuffer(sz.x, sz.y); extraTextureBuffer->SetDepthAttachment(mainTextureBuffer->GetDepthAttachment()); extraCameraInput->SetRenderTarget(extraTextureBuffer); auto extraSprite = CreateSprite(world, sz.x, sz.y); extraSprite->SetPosition(0, 0, -0.00001); extraSprite->SetRenderLayers(OUTPUT_LAYER); auto extraMaterial = CreateMaterial(); extraMaterial->SetShaderFamily(unlitShader); extraSprite->SetMaterial(extraMaterial); extraMaterial->SetTransparent(true); extraMaterial->SetTexture(extraTextureBuffer->GetColorAttachment()); extraMaterial->SetColor(1, 1, 1, 0.5); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
-
Dreikblack's post in Non-latin symbols not displayed was marked as the answer
Seems to be resolved at some point in beta branch
-
Dreikblack's post in Can't build after last update in beta steam branch was marked as the answer
After VS update i managed to build a projects
-
Dreikblack's post in Render crash if reCreateWorld same world was marked as the answer
This issue seems to be gone with Vulkan
-
Dreikblack's post in [C++] Editor doesn't show components was marked as the answer
Works for me with original .json from top post. Try to create new component via editor with + button
btw maybe some letter is not latin? Like Cyrillic 'C' instead of English one in folder and file name.
-
Dreikblack's post in Quake models in Editor was marked as the answer
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"
-
Dreikblack's post in Brush and Face SetMaterial() does not work? was marked as the answer
Now in 1.03 it works for brush and face
-
Dreikblack's post in Help changing font color was marked as the answer
widget->SetColor(1, 0, 0, 1, WIDGETCOLOR_FOREGROUND);
-
Dreikblack's post in Ultra App Kit - table was marked as the answer
Edit button just for having 2 buttons in a menu:
add shared_ptr<Panel> contextMenu; to ListView.h
In ListView.cpp update Initialize method:
bool ListView::Initialize(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent, shared_ptr<ListViewData> header, int columnCount) { bool isInit = Widget::Initialize("", x, y, width, height, parent, 0); itemSize = iVec2(width, getItemHeight()); ListView::columnCount = columnCount; initBlockCount += (columnCount * 2); ListView::header = header; contextMenu = CreatePanel(0, 0, 100, 40, gui->root); contextMenu->Hide(); auto editButton = CreateButton("Edit", 0, 0, 100, 20, contextMenu);//just for an example, no function auto removeButton = CreateButton("Remove", 0, 20, 100, 20, contextMenu); ListenEvent(EVENT_WIDGETACTION, removeButton, RemoveCallback, Self()->As<ListView>()); return isInit; } and MouseDown method:
void ListView::MouseDown(const MouseButton button, const int x, const int y) { contextMenu->Hide(); if (x >= 0 and y >= getItemHeight() and x < size.x and y < size.y) { int itemId = y / getItemHeight() - 1; if (itemId >= 0 and itemId < items.size()) { selectedItemId = itemId; Redraw(); if (button == MOUSE_LEFT) { if (pickItemListener) { pickItemListener(Event(EVENT_WIDGETACTION, Self(), selectedItemId)); } } else if (button == MOUSE_RIGHT) { contextMenu->Show(); contextMenu->SetShape(iVec2(x, y), contextMenu->GetSize()); } } } } Also add this function to same class:
bool RemoveCallback(const Event& ev, shared_ptr<Object> extra) { auto listView = extra->As<ListView>(); listView->removeSelectedItem(); listView->contextMenu->Hide(); return true; }
-
Dreikblack's post in Ultra Engine Client closes it self before full start (Windows 11) was marked as the answer
Tried newer version from here - https://github.com/UltraEngine/ultraengine.github.io/raw/main/files/UltraClient.exe and it worked . Found in a patch notes.
Probably main link should be updated? - https://ultraengine.github.io/files/UltraClient.exe