添加鼠标点击实体事件,添加spirv着色器系统
This commit is contained in:
@ -63,7 +63,7 @@ namespace Hazel
|
||||
}
|
||||
|
||||
// update camera
|
||||
if (m_ViewportFocused && m_ViewportHovered)
|
||||
if (m_ViewportFocused)
|
||||
{
|
||||
m_CameraController.OnUpdate(ts);
|
||||
m_EditorCamera.OnUpdate(ts);
|
||||
@ -284,10 +284,9 @@ namespace Hazel
|
||||
snapValue = 0.25f;
|
||||
|
||||
float snapValues[3] = {snapValue, snapValue, snapValue};
|
||||
|
||||
if (ImGuizmo::Manipulate(glm::value_ptr(cameraView), glm::value_ptr(cameraProjection),
|
||||
ImGuizmo::OPERATION(m_GizmoType), ImGuizmo::LOCAL,
|
||||
glm::value_ptr(transform), nullptr, snap ? snapValues : nullptr))
|
||||
glm::value_ptr(transform), nullptr, snap ? snapValues : nullptr) && !Input::IsKeyPressed(SDL_SCANCODE_LALT))
|
||||
{
|
||||
if (ImGuizmo::IsUsing())
|
||||
{
|
||||
@ -352,11 +351,13 @@ namespace Hazel
|
||||
|
||||
void EditorLayer::OnEvent(SDL_Event& e)
|
||||
{
|
||||
if (m_ViewportFocused && m_ViewportHovered)
|
||||
if (m_ViewportFocused)
|
||||
{
|
||||
m_CameraController.OnEvent(e);
|
||||
m_EditorCamera.OnEvent(e);
|
||||
}
|
||||
if (e.button.clicks && m_ViewportHovered && !ImGuizmo::IsOver() && Input::IsMouseButtonPressed(SDL_BUTTON_LEFT) && !Input::IsKeyPressed(SDL_SCANCODE_LALT))
|
||||
m_SceneHierachyPanel.SetSelectedEntity(m_HoveredEntity);
|
||||
|
||||
#define SHORTCUT_NEW (SDL_KMOD_CTRL | SDLK_N)
|
||||
#define SHORTCUT_OPEN (SDL_KMOD_CTRL | SDLK_O)
|
||||
|
||||
@ -338,4 +338,9 @@ namespace Hazel
|
||||
ImGui::ColorEdit4("Color", glm::value_ptr(component.Color));
|
||||
});
|
||||
}
|
||||
|
||||
void SceneHierachyPanel::SetSelectedEntity(const Entity entity)
|
||||
{
|
||||
m_SelectionContext = entity;
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ namespace Hazel
|
||||
void OnImGuiRender();
|
||||
|
||||
void DrawComponents(Entity entity);
|
||||
void SetSelectedEntity(const Entity entity);
|
||||
|
||||
Entity GetSelectedEntity() const { return m_SelectionContext; }
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user