Kiwano Engine v1.3.x
imgui_impl.h
1// dear imgui: Renderer for Kiwano
2
3#pragma once
4
5#ifndef KGE_DOXYGEN_DO_NOT_INCLUDE
6
7#if !defined(KGE_USE_DIRECTX10)
8
9#include <kiwano-imgui/imgui_impl/imgui_impl_dx11.h>
10#include <kiwano/render/DirectX/D3DDeviceResources.h>
11
12inline bool ImGui_Impl_Init()
13{
14 auto d3d = kiwano::graphics::directx::GetD3DDeviceResources();
15 return ImGui_ImplDX11_Init(d3d->GetDevice(), d3d->GetDeviceContext());
16}
17
18inline void ImGui_Impl_Shutdown()
19{
20 ImGui_ImplDX11_Shutdown();
21}
22
23inline void ImGui_Impl_NewFrame()
24{
25 ImGui_ImplDX11_NewFrame();
26}
27
28inline void ImGui_Impl_RenderDrawData(ImDrawData* draw_data)
29{
30 ImGui_ImplDX11_RenderDrawData(draw_data);
31}
32
33inline void ImGui_Impl_InvalidateDeviceObjects()
34{
35 ImGui_ImplDX11_InvalidateDeviceObjects();
36}
37
38inline bool ImGui_Impl_CreateDeviceObjects()
39{
40 return ImGui_ImplDX11_CreateDeviceObjects();
41}
42
43#else
44
45#include <kiwano-imgui/imgui_impl/imgui_impl_dx10.h>
46#include <kiwano/render/DirectX/D3DDeviceResources.h>
47
48inline bool ImGui_Impl_Init()
49{
50 auto d3d = kiwano::graphics::directx::GetD3DDeviceResources();
51 return ImGui_ImplDX10_Init(d3d->GetDevice());
52}
53
54inline void ImGui_Impl_Shutdown()
55{
56 ImGui_ImplDX10_Shutdown();
57}
58
59inline void ImGui_Impl_NewFrame()
60{
61 ImGui_ImplDX10_NewFrame();
62}
63
64inline void ImGui_Impl_RenderDrawData(ImDrawData* draw_data)
65{
66 ImGui_ImplDX10_RenderDrawData(draw_data);
67}
68
69inline void ImGui_Impl_InvalidateDeviceObjects()
70{
71 ImGui_ImplDX10_InvalidateDeviceObjects();
72}
73
74inline bool ImGui_Impl_CreateDeviceObjects()
75{
76 return ImGui_ImplDX10_CreateDeviceObjects();
77}
78
79#endif
80
81#endif