Kiwano Engine
v1.2.x
ImGuiLayer.h
1
// Copyright (c) 2016-2018 Kiwano - Nomango
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a copy
4
// of this software and associated documentation files (the "Software"), to deal
5
// in the Software without restriction, including without limitation the rights
6
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
// copies of the Software, and to permit persons to whom the Software is
8
// furnished to do so, subject to the following conditions:
9
//
10
// The above copyright notice and this permission notice shall be included in
11
// all copies or substantial portions of the Software.
12
//
13
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
// THE SOFTWARE.
20
21
#pragma once
22
#include <kiwano/2d/LayerActor.h>
23
24
namespace
kiwano
25
{
26
namespace
imgui
27
{
28
KGE_DECLARE_SMART_PTR(ImGuiLayer);
29
32
using
ImGuiPipeline = Function<void()>;
33
38
class
ImGuiLayer
:
public
LayerActor
39
{
40
public
:
41
ImGuiLayer
();
42
47
ImGuiLayer
(
const
String& name,
const
ImGuiPipeline
& item);
48
49
virtual
~ImGuiLayer
();
50
55
void
AddItem
(
const
String& name,
const
ImGuiPipeline
& item);
56
60
void
RemoveItem
(
const
String& name);
61
62
// 移除所有元素
65
void
RemoveAllItems
();
66
67
public
:
68
void
OnRender
(
RenderContext
& ctx)
override
;
69
70
bool
CheckVisibility
(
RenderContext
& ctx)
const override
;
71
72
private
:
73
Map<String, ImGuiPipeline> pipelines_;
74
};
75
}
// namespace imgui
76
}
// namespace kiwano
kiwano::Function< void()>
kiwano::LayerActor
图层角色
Definition:
LayerActor.h:40
kiwano::RenderContext
渲染上下文
Definition:
RenderContext.h:64
kiwano::imgui::ImGuiLayer
ImGui图层
Definition:
ImGuiLayer.h:39
kiwano::imgui::ImGuiLayer::RemoveItem
void RemoveItem(const String &name)
移除 ImGui 元素
Definition:
ImGuiLayer.cpp:59
kiwano::imgui::ImGuiLayer::CheckVisibility
bool CheckVisibility(RenderContext &ctx) const override
检查是否在渲染上下文的视区内
Definition:
ImGuiLayer.cpp:49
kiwano::imgui::ImGuiLayer::OnRender
void OnRender(RenderContext &ctx) override
渲染角色
Definition:
ImGuiLayer.cpp:41
kiwano::imgui::ImGuiLayer::RemoveAllItems
void RemoveAllItems()
移除所有元素
Definition:
ImGuiLayer.cpp:68
kiwano::imgui::ImGuiLayer::AddItem
void AddItem(const String &name, const ImGuiPipeline &item)
添加 ImGui 元素
Definition:
ImGuiLayer.cpp:54
src
kiwano-imgui
ImGuiLayer.h
制作者
1.9.4