diff --git a/Editor/src/Misc/GizmoDrawer.cpp b/Editor/src/Misc/GizmoDrawer.cpp index 5ea50b5c..51edc163 100644 --- a/Editor/src/Misc/GizmoDrawer.cpp +++ b/Editor/src/Misc/GizmoDrawer.cpp @@ -35,7 +35,7 @@ GizmoDrawer::GizmoDrawer() GenerateSphereGizmo(); // Box - const Color cubeColor = Color(1, 0, 0, 1); + const Color cubeColor = Color(1, 0, 0, 0.5f); std::vector mBoxVertices = { LineVertex{Vector3(-1.f, -1.f, -1.f), cubeColor}, @@ -110,8 +110,8 @@ void GizmoDrawer::GenerateSphereGizmo() vert2 = Vector3(x2, 0, z2); } - circleVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 1.0) }); - circleVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 1.0) }); + circleVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 0.5) }); + circleVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 0.5) }); } mCircleBuffer = CreateRef(); diff --git a/Editor/src/Misc/Gizmos/CapsuleGizmo.cpp b/Editor/src/Misc/Gizmos/CapsuleGizmo.cpp index abb3fd4e..c6a31363 100644 --- a/Editor/src/Misc/Gizmos/CapsuleGizmo.cpp +++ b/Editor/src/Misc/Gizmos/CapsuleGizmo.cpp @@ -62,8 +62,8 @@ void CapsuleGizmo::CreateMesh() vert2 = Vector3(x2, bottomCircleHeight, z2); } - _CapsuleVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 1.0) }); - _CapsuleVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 1.0) }); + _CapsuleVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 0.5) }); + _CapsuleVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 0.5) }); } for (int i = 0; i < subDivision * 2.0; i++) @@ -94,21 +94,21 @@ void CapsuleGizmo::CreateMesh() vert2 = Vector3(0, z2 + heightOffset, x2); } - _CapsuleVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 1.0) }); - _CapsuleVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 1.0) }); + _CapsuleVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 0.5) }); + _CapsuleVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 0.5) }); } - _CapsuleVertices.push_back(LineVertex{ Vector3(radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(-radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(-radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(-radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(-radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, radius), Color(1.0, 0, 0.0, 1.0) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, radius), Color(1.0, 0, 0.0, 1.0) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, radius), Color(1.0, 0, 0.0, 0.5) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, radius), Color(1.0, 0, 0.0, 0.5) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, -radius), Color(1.0, 0, 0.0, 1.0) }); - _CapsuleVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, -radius), Color(1.0, 0, 0.0, 1.0) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, -radius), Color(1.0, 0, 0.0, 0.5) }); + _CapsuleVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, -radius), Color(1.0, 0, 0.0, 0.5) }); _CapsuleBuffer = CreateRef(); _CapsuleBuffer->Bind(); diff --git a/Editor/src/Misc/Gizmos/CylinderGizmo.cpp b/Editor/src/Misc/Gizmos/CylinderGizmo.cpp index dc86ce3d..89d26df7 100644 --- a/Editor/src/Misc/Gizmos/CylinderGizmo.cpp +++ b/Editor/src/Misc/Gizmos/CylinderGizmo.cpp @@ -62,21 +62,21 @@ void CylinderGizmo::CreateMesh() vert2 = Vector3(x2, bottomCircleHeight, z2); } - _CylinderVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 1.0) }); - _CylinderVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 1.0) }); + _CylinderVertices.push_back(LineVertex{ vert1, Color(1.0, 0, 0.0, 0.5) }); + _CylinderVertices.push_back(LineVertex{ vert2, Color(1.0, 0, 0.0, 0.5) }); } - _CylinderVertices.push_back(LineVertex{ Vector3(radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); - _CylinderVertices.push_back(LineVertex{ Vector3(radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); + _CylinderVertices.push_back(LineVertex{ Vector3(radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); + _CylinderVertices.push_back(LineVertex{ Vector3(radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); - _CylinderVertices.push_back(LineVertex{ Vector3(-radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); - _CylinderVertices.push_back(LineVertex{ Vector3(-radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 1.0) }); + _CylinderVertices.push_back(LineVertex{ Vector3(-radius, bottomCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); + _CylinderVertices.push_back(LineVertex{ Vector3(-radius, topCircleHeight, 0), Color(1.0, 0, 0.0, 0.5) }); - _CylinderVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, radius), Color(1.0, 0, 0.0, 1.0) }); - _CylinderVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, radius), Color(1.0, 0, 0.0, 1.0) }); + _CylinderVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, radius), Color(1.0, 0, 0.0, 0.5) }); + _CylinderVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, radius), Color(1.0, 0, 0.0, 0.5) }); - _CylinderVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, -radius), Color(1.0, 0, 0.0, 1.0) }); - _CylinderVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, -radius), Color(1.0, 0, 0.0, 1.0) }); + _CylinderVertices.push_back(LineVertex{ Vector3(0, bottomCircleHeight, -radius), Color(1.0, 0, 0.0, 0.5) }); + _CylinderVertices.push_back(LineVertex{ Vector3(0, topCircleHeight, -radius), Color(1.0, 0, 0.0, 0.5) }); _CylinderBuffer = CreateRef(); _CylinderBuffer->Bind(); diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index 111074bb..e6a95da8 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -246,7 +246,7 @@ namespace Nuake { } m_IsViewportFocused = ImGui::IsWindowFocused(); - if (m_IsHoveringViewport && Input::IsMouseButtonPressed(GLFW_MOUSE_BUTTON_2) && !ImGuizmo::IsUsing()) + if (m_IsHoveringViewport && Input::IsMouseButtonPressed(GLFW_MOUSE_BUTTON_1) && !ImGuizmo::IsUsing()) { ImGui::FocusWindow(ImGui::GetCurrentWindow()); @@ -1375,7 +1375,7 @@ namespace Nuake { Selection = EditorSelection(); } - if (ImGui::MenuItem("Open...", "CTRL+O")) + if (ImGui::MenuItem("Open...")) { OpenProject(); @@ -1406,7 +1406,7 @@ namespace Nuake { Engine::LoadScene(Scene::New()); Selection = EditorSelection(); } - if (ImGui::MenuItem("Open scene...", "CTRL+SHIFT+O")) + if (ImGui::MenuItem("Open scene...", "CTRL+O")) { OpenScene(); Selection = EditorSelection(); @@ -1528,6 +1528,31 @@ namespace Nuake { return; } + // Shortcuts + if(ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) + { + if(ImGui::IsKeyPressed(ImGuiKey_S)) + { + Engine::GetProject()->Save(); + Engine::GetCurrentScene()->Save(); + + Selection = EditorSelection(); + } + else if(ImGui::IsKeyPressed(ImGuiKey_O)) + { + OpenScene(); + + Selection = EditorSelection(); + } + else if(ImGui::IsKeyDown(ImGuiKey_LeftShift) && ImGui::IsKeyPressed(ImGuiKey_S)) + { + std::string savePath = FileDialog::SaveFile("*.project"); + Engine::GetProject()->SaveAs(savePath); + + Selection = EditorSelection(); + } + } + if (_WelcomeWindow->IsProjectQueued() && frameCount > 0) { // draw splash diff --git a/premake5.lua b/premake5.lua index 98745469..73cfe316 100644 --- a/premake5.lua +++ b/premake5.lua @@ -90,10 +90,16 @@ project "Editor" objdir ("bin-int/" .. outputdir .. "/%{prj.name}") debugdir ("%{prj.name}") + defines + { + + } + files { - "%{prj.name}/**.h", - "%{prj.name}/**.cpp", + "%{prj.name}/Editor.cpp", + "%{prj.name}/src/**.cpp", + "%{prj.name}/src/**.h", "%{prj.name}/resources/*.rc", "%{prj.name}/resources/**.ico" }