|
|
|
|
/******************************************************************************
|
|
|
|
|
* File - component_guis.cpp
|
|
|
|
|
* Author - Joey Pollack
|
|
|
|
|
* Date - 2022/06/01 (y/m/d)
|
|
|
|
|
* Mod Date - 2022/06/01 (y/m/d)
|
|
|
|
|
* Description - Functions to render component editing GUIs
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "component_guis.h"
|
|
|
|
|
#include <editor/editor.h>
|
|
|
|
|
#include <utils/logger.h>
|
|
|
|
|
#include <gui/imgui_ext.h>
|
|
|
|
|
#include <dearimgui/imgui.h>
|
|
|
|
|
#include <dearimgui/imgui_internal.h>
|
|
|
|
|
|
|
|
|
|
namespace lunarium { namespace editor
|
|
|
|
|
{
|
|
|
|
|
void CompGui::RenderTagComp(TagComponent& comp)
|
|
|
|
|
{
|
|
|
|
|
ImGuiExt::TextCentered("Tag Component");
|
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(3.0f, ImGui::GetStyle().ItemSpacing.y));
|
|
|
|
|
|
|
|
|
|
const int BUFFER_SIZE = 256;
|
|
|
|
|
static char buffer[BUFFER_SIZE] = "";
|
|
|
|
|
ImGui::Text("Tag Info");
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
strcpy(buffer, comp.Info.c_str());
|
|
|
|
|
ImGui::InputText("##Tag", buffer, BUFFER_SIZE);
|
|
|
|
|
comp.Info = buffer;
|
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// This code taken from the Hazel engine
|
|
|
|
|
/// https://github.com/TheCherno/Hazel/blob/master/Hazelnut/src/Panels/SceneHierarchyPanel.cpp
|
|
|
|
|
void CompGui::RenderTransformComp(TransformComponent& comp)
|
|
|
|
|
{
|
|
|
|
|
ImGuiExt::Vec3Control("Translation", comp.Position, 0.0f, 85.0f);
|
|
|
|
|
glm::vec3 rotation = glm::degrees(comp.Rotation);
|
|
|
|
|
ImGuiExt::Vec3Control("Rotation", rotation, 0.0f, 85.0f);
|
|
|
|
|
comp.Rotation = glm::radians(rotation);
|
|
|
|
|
ImGuiExt::Vec3Control("Scale", comp.Scale, 1.0f, 85.0f);
|
|
|
|
|
}
|
|
|
|
|
}}
|