mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-27 16:17:12 +03:00
Added panel for box collider and created first rigidbody
This commit is contained in:
39
Editor/src/ComponentsPanel/BoxColliderPanel.h
Normal file
39
Editor/src/ComponentsPanel/BoxColliderPanel.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
#include "ComponentPanel.h"
|
||||
#include <src/Scene/Components/BoxCollider.h>
|
||||
#include <src/Core/FileSystem.h>
|
||||
#include <src/Scene/Entities/ImGuiHelper.h>
|
||||
|
||||
class BoxColliderPanel : ComponentPanel {
|
||||
public:
|
||||
BoxColliderPanel() {}
|
||||
|
||||
void Draw(Nuake::Entity entity) override
|
||||
{
|
||||
if (!entity.HasComponent<Nuake::BoxColliderComponent>())
|
||||
return;
|
||||
|
||||
auto& component = entity.GetComponent<Nuake::BoxColliderComponent>();
|
||||
BeginComponentTable(BOX COLLIDER, Nuake::BoxColliderComponent);
|
||||
{
|
||||
{
|
||||
ImGui::Text("Size");
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGuiHelper::DrawVec3("BoxSize", &component.Size);
|
||||
ImGui::TableNextColumn();
|
||||
ComponentTableReset(component.Size, glm::vec3(1, 1, 1));
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
{
|
||||
ImGui::Text("Is Trigger");
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::Checkbox("##isTrigger", &component.IsTrigger);
|
||||
ImGui::TableNextColumn();
|
||||
ComponentTableReset(component.IsTrigger, false);
|
||||
}
|
||||
}
|
||||
EndComponentTable();
|
||||
}
|
||||
};
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
ImGui::Text("Collision");
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::Checkbox("#Collison", &component.HasCollisions);
|
||||
ImGui::Checkbox("##Collison", &component.HasCollisions);
|
||||
ImGui::TableNextColumn();
|
||||
ComponentTableReset(component.HasCollisions, true);
|
||||
}
|
||||
|
||||
@@ -1399,6 +1399,11 @@ namespace Nuake {
|
||||
|
||||
void EditorInterface::Update(float ts)
|
||||
{
|
||||
if (!Engine::GetCurrentScene())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto& editorCam = Engine::GetCurrentScene()->m_EditorCamera;
|
||||
editorCam->Update(ts, m_IsHoveringViewport);
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ EditorSelectionPanel::EditorSelectionPanel()
|
||||
mQuakeMapPanel = QuakeMapPanel();
|
||||
mCameraPanel = CameraPanel();
|
||||
mRigidbodyPanel = RigidbodyPanel();
|
||||
mBoxColliderPanel = BoxColliderPanel();
|
||||
}
|
||||
|
||||
void EditorSelectionPanel::ResolveFile(Ref<Nuake::File> file)
|
||||
@@ -98,6 +99,7 @@ void EditorSelectionPanel::DrawEntity(Nuake::Entity entity)
|
||||
mQuakeMapPanel.Draw(entity);
|
||||
mCameraPanel.Draw(entity);
|
||||
mRigidbodyPanel.Draw(entity);
|
||||
mBoxColliderPanel.Draw(entity);
|
||||
|
||||
/*
|
||||
if (Selection.Entity.HasComponent<MeshComponent>())
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
#include "../Actions/EditorSelection.h"
|
||||
#include "src/Scene/Entities/Entity.h"
|
||||
|
||||
#include "src/Core/FileSystem.h"
|
||||
#include <src/Resource/Project.h>
|
||||
|
||||
#include "../ComponentsPanel/TransformPanel.h"
|
||||
#include "../ComponentsPanel/LightPanel.h"
|
||||
@@ -10,9 +12,7 @@
|
||||
#include "../ComponentsPanel/QuakeMapPanel.h"
|
||||
#include "../ComponentsPanel/CameraPanel.h"
|
||||
#include "../ComponentsPanel/RigidbodyPanel.h"
|
||||
|
||||
#include "../Actions/EditorSelection.h"
|
||||
#include <src/Resource/Project.h>
|
||||
#include "../ComponentsPanel/BoxColliderPanel.h"
|
||||
|
||||
class EditorSelectionPanel {
|
||||
private:
|
||||
@@ -23,9 +23,11 @@ private:
|
||||
QuakeMapPanel mQuakeMapPanel;
|
||||
CameraPanel mCameraPanel;
|
||||
RigidbodyPanel mRigidbodyPanel;
|
||||
BoxColliderPanel mBoxColliderPanel;
|
||||
|
||||
Ref<Nuake::File> currentFile;
|
||||
Ref<Nuake::Resource> selectedResource;
|
||||
|
||||
public:
|
||||
EditorSelectionPanel();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user