54 lines
932 B
C
54 lines
932 B
C
|
|
// Copyright (C) 2019 Nomango
|
|||
|
|
|
|||
|
|
#pragma once
|
|||
|
|
|
|||
|
|
namespace easy2d
|
|||
|
|
{
|
|||
|
|
E2D_DECLARE_SMART_PTR(ImGuiLayer);
|
|||
|
|
|
|||
|
|
using ImGuiPipeline = std::function<void()>;
|
|||
|
|
|
|||
|
|
class ImGuiLayer
|
|||
|
|
: public Layer
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
ImGuiLayer();
|
|||
|
|
|
|||
|
|
virtual ~ImGuiLayer();
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> ImGui Ԫ<><D4AA>
|
|||
|
|
void AddItem(
|
|||
|
|
ImGuiPipeline const& item,
|
|||
|
|
String const& name
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
// <20>Ƴ<EFBFBD> ImGui Ԫ<><D4AA>
|
|||
|
|
void RemoveItem(
|
|||
|
|
String const& name
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
// <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA>
|
|||
|
|
void RemoveAllItems();
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
void OnMouseButtonDown(int btn, Point const& p) override;
|
|||
|
|
void OnMouseButtonUp(int btn, Point const& p) override;
|
|||
|
|
void OnMouseWheel(float wheel) override;
|
|||
|
|
|
|||
|
|
void OnKeyDown(int key) override;
|
|||
|
|
void OnKeyUp(int key) override;
|
|||
|
|
void OnChar(char c) override;
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
void OnUpdate(Duration dt) override;
|
|||
|
|
void OnRender() override;
|
|||
|
|
|
|||
|
|
void UpdateMousePos();
|
|||
|
|
void UpdateMouseCursor();
|
|||
|
|
|
|||
|
|
protected:
|
|||
|
|
HWND target_window_;
|
|||
|
|
Map<String, ImGuiPipeline> pipelines_;
|
|||
|
|
};
|
|||
|
|
}
|