|
|
|
@ -22,7 +22,7 @@ namespace lunarium { namespace editor
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
// COMMON SECTIONS
|
|
|
|
// COMMON SECTIONS
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
static void DrawTitle(std::string title)
|
|
|
|
static bool DrawTitle(std::string title)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ImVec2 top_left(ImGui::GetWindowPos().x, ImGui::GetCursorScreenPos().y - ImGui::GetStyle().FramePadding.y);
|
|
|
|
ImVec2 top_left(ImGui::GetWindowPos().x, ImGui::GetCursorScreenPos().y - ImGui::GetStyle().FramePadding.y);
|
|
|
|
ImVec2 bot_right(top_left.x + ImGui::GetWindowSize().x, ImGui::GetCursorScreenPos().y + ImGui::GetFrameHeight());
|
|
|
|
ImVec2 bot_right(top_left.x + ImGui::GetWindowSize().x, ImGui::GetCursorScreenPos().y + ImGui::GetFrameHeight());
|
|
|
|
@ -30,11 +30,16 @@ namespace lunarium { namespace editor
|
|
|
|
ImU32 color = ImGui::ColorConvertFloat4ToU32(ImVec4(0.3f, 0.3f, 0.3f, 1.0f));
|
|
|
|
ImU32 color = ImGui::ColorConvertFloat4ToU32(ImVec4(0.3f, 0.3f, 0.3f, 1.0f));
|
|
|
|
ImGui::GetWindowDrawList()->AddRectFilled(top_left, bot_right, color);
|
|
|
|
ImGui::GetWindowDrawList()->AddRectFilled(top_left, bot_right, color);
|
|
|
|
ImGuiExt::TextCentered(title.c_str());
|
|
|
|
ImGuiExt::TextCentered(title.c_str());
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
|
|
|
std::string label = "X##";
|
|
|
|
|
|
|
|
label += title;
|
|
|
|
|
|
|
|
return ImGui::Button(label.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CompGui::RenderTagComp(TagComponent& comp)
|
|
|
|
bool CompGui::RenderTagComp(TagComponent& comp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DrawTitle("Tag Component");
|
|
|
|
bool remove = false;
|
|
|
|
|
|
|
|
remove = DrawTitle("Tag Component");
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(3.0f, ImGui::GetStyle().ItemSpacing.y));
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(3.0f, ImGui::GetStyle().ItemSpacing.y));
|
|
|
|
const int BUFFER_SIZE = 256;
|
|
|
|
const int BUFFER_SIZE = 256;
|
|
|
|
@ -46,14 +51,16 @@ namespace lunarium { namespace editor
|
|
|
|
comp.Info = buffer;
|
|
|
|
comp.Info = buffer;
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return remove;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// This code taken from the Hazel engine
|
|
|
|
/// This code taken from the Hazel engine
|
|
|
|
/// https://github.com/TheCherno/Hazel/blob/master/Hazelnut/src/Panels/SceneHierarchyPanel.cpp
|
|
|
|
/// https://github.com/TheCherno/Hazel/blob/master/Hazelnut/src/Panels/SceneHierarchyPanel.cpp
|
|
|
|
void CompGui::RenderTransformComp(TransformComponent& comp)
|
|
|
|
bool CompGui::RenderTransformComp(TransformComponent& comp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
bool remove = false;
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(ImGui::GetStyle().ItemSpacing.x, ImGui::GetStyle().ItemSpacing.y + 10.0f));
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(ImGui::GetStyle().ItemSpacing.x, ImGui::GetStyle().ItemSpacing.y + 10.0f));
|
|
|
|
DrawTitle("Transform Component");
|
|
|
|
remove = DrawTitle("Transform Component");
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
|
|
|
|
|
|
|
|
ImGuiExt::Vec2Control("Translation", comp.Position, 0.0f, 85.0f);
|
|
|
|
ImGuiExt::Vec2Control("Translation", comp.Position, 0.0f, 85.0f);
|
|
|
|
@ -62,23 +69,29 @@ namespace lunarium { namespace editor
|
|
|
|
ImGuiExt::FloatControl("Rotation", rotation.z, 0.0f, 85.0f);
|
|
|
|
ImGuiExt::FloatControl("Rotation", rotation.z, 0.0f, 85.0f);
|
|
|
|
comp.Rotation = glm::radians(rotation);
|
|
|
|
comp.Rotation = glm::radians(rotation);
|
|
|
|
ImGuiExt::Vec2Control("Scale", comp.Scale, 1.0f, 85.0f);
|
|
|
|
ImGuiExt::Vec2Control("Scale", comp.Scale, 1.0f, 85.0f);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return remove;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CompGui::RenderVelocityComp(VelocityComponent& comp)
|
|
|
|
bool CompGui::RenderVelocityComp(VelocityComponent& comp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
bool remove = false;
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(ImGui::GetStyle().ItemSpacing.x, ImGui::GetStyle().ItemSpacing.y + 10.0f));
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(ImGui::GetStyle().ItemSpacing.x, ImGui::GetStyle().ItemSpacing.y + 10.0f));
|
|
|
|
DrawTitle("Velocity Component");
|
|
|
|
remove = DrawTitle("Velocity Component");
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
|
|
|
|
|
|
|
|
ImGuiExt::Vec2Control("Velocity", comp.Velocity, 0.0f, 85.0f);
|
|
|
|
ImGuiExt::Vec2Control("Velocity", comp.Velocity, 0.0f, 85.0f);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return remove;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CompGui::RenderCameraComp(CameraComponent& comp)
|
|
|
|
bool CompGui::RenderCameraComp(CameraComponent& comp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
bool remove = false;
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(ImGui::GetStyle().ItemSpacing.x, ImGui::GetStyle().ItemSpacing.y + 10.0f));
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(ImGui::GetStyle().ItemSpacing.x, ImGui::GetStyle().ItemSpacing.y + 10.0f));
|
|
|
|
DrawTitle("Camera Component");
|
|
|
|
remove = DrawTitle("Camera Component");
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
|
|
|
|
|
|
|
|
glm::vec3 pos = comp.Camera.GetPosition();
|
|
|
|
glm::vec3 pos = comp.Camera.GetPosition();
|
|
|
|
@ -92,13 +105,16 @@ namespace lunarium { namespace editor
|
|
|
|
{
|
|
|
|
{
|
|
|
|
comp.Camera.SetRotation(rot);
|
|
|
|
comp.Camera.SetRotation(rot);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return remove;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CompGui::RenderBlockOutComp(BlockOutComponent& comp)
|
|
|
|
bool CompGui::RenderBlockOutComp(BlockOutComponent& comp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
bool remove = false;
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(ImGui::GetStyle().ItemSpacing.x, ImGui::GetStyle().ItemSpacing.y + 10.0f));
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(ImGui::GetStyle().ItemSpacing.x, ImGui::GetStyle().ItemSpacing.y + 10.0f));
|
|
|
|
DrawTitle("Block Out Component");
|
|
|
|
remove = DrawTitle("Block Out Component");
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::Text("Block Color: ");
|
|
|
|
ImGui::Text("Block Color: ");
|
|
|
|
@ -115,5 +131,8 @@ namespace lunarium { namespace editor
|
|
|
|
ImGui::Text("Render Layer: ");
|
|
|
|
ImGui::Text("Render Layer: ");
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::InputInt("##Render Layer", &comp.RenderLayer, 1, 10);
|
|
|
|
ImGui::InputInt("##Render Layer", &comp.RenderLayer, 1, 10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return remove;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
}}
|