mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-27 16:17:12 +03:00
Reworked editor camera
This commit is contained in:
30
Editor/src/ComponentsPanel/RigidbodyPanel.h
Normal file
30
Editor/src/ComponentsPanel/RigidbodyPanel.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
#include "ComponentPanel.h"
|
||||
#include <src/Scene/Components/RigidbodyComponent.h>
|
||||
#include <src/Core/FileSystem.h>
|
||||
|
||||
class RigidbodyPanel : ComponentPanel {
|
||||
|
||||
public:
|
||||
RigidbodyPanel() {}
|
||||
|
||||
void Draw(Nuake::Entity entity) override
|
||||
{
|
||||
if (!entity.HasComponent<Nuake::RigidBodyComponent>())
|
||||
return;
|
||||
|
||||
auto& component = entity.GetComponent<Nuake::RigidBodyComponent>();
|
||||
BeginComponentTable(RIGIDBODY, Nuake::RigidBodyComponent);
|
||||
{
|
||||
{
|
||||
ImGui::Text("Mass");
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::DragFloat("##Mass", &component.Mass, 0.1f, 0.1f);
|
||||
ImGui::TableNextColumn();
|
||||
ComponentTableReset(component.Mass, 0.0f);
|
||||
}
|
||||
}
|
||||
EndComponentTable();
|
||||
}
|
||||
};
|
||||
@@ -1406,7 +1406,12 @@ namespace Nuake {
|
||||
if (entityIsSelected && Input::IsKeyPressed(GLFW_KEY_F))
|
||||
{
|
||||
editorCam->IsMoving = true;
|
||||
editorCam->TargetPos = Vector3(0, 0, 0);
|
||||
editorCam->TargetPos = Selection.Entity.GetComponent<TransformComponent>().GetGlobalPosition();
|
||||
}
|
||||
|
||||
if (entityIsSelected && Input::IsKeyPressed(GLFW_KEY_ESCAPE))
|
||||
{
|
||||
Selection = EditorSelection();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ EditorSelectionPanel::EditorSelectionPanel()
|
||||
mScriptPanel = ScriptPanel();
|
||||
mQuakeMapPanel = QuakeMapPanel();
|
||||
mCameraPanel = CameraPanel();
|
||||
mRigidbodyPanel = RigidbodyPanel();
|
||||
}
|
||||
|
||||
void EditorSelectionPanel::ResolveFile(Ref<Nuake::File> file)
|
||||
@@ -96,6 +97,8 @@ void EditorSelectionPanel::DrawEntity(Nuake::Entity entity)
|
||||
mMeshPanel.Draw(entity);
|
||||
mQuakeMapPanel.Draw(entity);
|
||||
mCameraPanel.Draw(entity);
|
||||
mRigidbodyPanel.Draw(entity);
|
||||
|
||||
/*
|
||||
if (Selection.Entity.HasComponent<MeshComponent>())
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "../ComponentsPanel/MeshPanel.h"
|
||||
#include "../ComponentsPanel/QuakeMapPanel.h"
|
||||
#include "../ComponentsPanel/CameraPanel.h"
|
||||
#include "../ComponentsPanel/RigidbodyPanel.h"
|
||||
|
||||
#include "../Actions/EditorSelection.h"
|
||||
#include <src/Resource/Project.h>
|
||||
@@ -21,6 +22,7 @@ private:
|
||||
MeshPanel mMeshPanel;
|
||||
QuakeMapPanel mQuakeMapPanel;
|
||||
CameraPanel mCameraPanel;
|
||||
RigidbodyPanel mRigidbodyPanel;
|
||||
|
||||
Ref<Nuake::File> currentFile;
|
||||
Ref<Nuake::Resource> selectedResource;
|
||||
|
||||
Reference in New Issue
Block a user