summaryrefslogtreecommitdiffstats
path: root/Imgui/src
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-11-25 02:44:26 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-11-25 02:44:26 +0000
commitc7319683cf2ebbe52704f3ad59d79518da7c49f3 (patch)
tree90d61525b59845e375660df212d7cd3dbb24ce5d /Imgui/src
parentclang-formatted AssetLoader (diff)
downloadDiligentTools-c7319683cf2ebbe52704f3ad59d79518da7c49f3.tar.gz
DiligentTools-c7319683cf2ebbe52704f3ad59d79518da7c49f3.zip
clang-formatted ImGuiImpl
Diffstat (limited to 'Imgui/src')
-rw-r--r--Imgui/src/ImGuiImplAndroid.cpp41
-rw-r--r--Imgui/src/ImGuiImplDiligent.cpp158
-rw-r--r--Imgui/src/ImGuiImplLinuxX11.cpp120
-rw-r--r--Imgui/src/ImGuiImplLinuxXCB.cpp145
-rw-r--r--Imgui/src/ImGuiImplUWP.cpp76
-rw-r--r--Imgui/src/ImGuiImplWin32.cpp30
6 files changed, 292 insertions, 278 deletions
diff --git a/Imgui/src/ImGuiImplAndroid.cpp b/Imgui/src/ImGuiImplAndroid.cpp
index 55101f5..e8f69de 100644
--- a/Imgui/src/ImGuiImplAndroid.cpp
+++ b/Imgui/src/ImGuiImplAndroid.cpp
@@ -28,19 +28,18 @@
namespace Diligent
{
-ImGuiImplAndroid::ImGuiImplAndroid(IRenderDevice* pDevice,
- TEXTURE_FORMAT BackBufferFmt,
- TEXTURE_FORMAT DepthBufferFmt,
- Uint32 DisplayWidth,
- Uint32 DisplayHeight,
- Uint32 InitialVertexBufferSize,
- Uint32 InitialIndexBufferSize) :
- ImGuiImplDiligent(pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize)
+ImGuiImplAndroid::ImGuiImplAndroid(IRenderDevice* pDevice,
+ TEXTURE_FORMAT BackBufferFmt,
+ TEXTURE_FORMAT DepthBufferFmt,
+ Uint32 DisplayWidth,
+ Uint32 DisplayHeight,
+ Uint32 InitialVertexBufferSize,
+ Uint32 InitialIndexBufferSize) :
+ ImGuiImplDiligent{pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize}
{
-
- auto& io = ImGui::GetIO();
- io.DisplaySize = ImVec2(DisplayWidth, DisplayHeight);
- io.FontGlobalScale = 2;
+ auto& io = ImGui::GetIO();
+ io.DisplaySize = ImVec2(DisplayWidth, DisplayHeight);
+ io.FontGlobalScale = 2;
io.BackendPlatformName = "Diligent-ImGuiImplAndroid";
m_LastTimestamp = std::chrono::high_resolution_clock::now();
@@ -52,35 +51,35 @@ ImGuiImplAndroid::~ImGuiImplAndroid()
void ImGuiImplAndroid::NewFrame()
{
- auto now = std::chrono::high_resolution_clock::now();
- auto elapsed_ns = now - m_LastTimestamp;
+ auto now = std::chrono::high_resolution_clock::now();
+ auto elapsed_ns = now - m_LastTimestamp;
m_LastTimestamp = now;
- auto& io = ImGui::GetIO();
- io.DeltaTime = static_cast<float>(elapsed_ns.count() / 1e+9);
+ auto& io = ImGui::GetIO();
+ io.DeltaTime = static_cast<float>(elapsed_ns.count() / 1e+9);
ImGuiImplDiligent::NewFrame();
}
bool ImGuiImplAndroid::BeginDrag(float x, float y)
{
- auto& io = ImGui::GetIO();
- io.MousePos = ImVec2(x, y);
+ auto& io = ImGui::GetIO();
+ io.MousePos = ImVec2(x, y);
io.MouseDown[0] = true;
return io.WantCaptureMouse;
}
bool ImGuiImplAndroid::DragMove(float x, float y)
{
- auto& io = ImGui::GetIO();
+ auto& io = ImGui::GetIO();
io.MousePos = ImVec2(x, y);
return io.WantCaptureMouse;
}
bool ImGuiImplAndroid::EndDrag()
{
- auto& io = ImGui::GetIO();
+ auto& io = ImGui::GetIO();
io.MouseDown[0] = false;
return io.WantCaptureMouse;
}
-}
+} // namespace Diligent
diff --git a/Imgui/src/ImGuiImplDiligent.cpp b/Imgui/src/ImGuiImplDiligent.cpp
index 4df6974..03e3e76 100644
--- a/Imgui/src/ImGuiImplDiligent.cpp
+++ b/Imgui/src/ImGuiImplDiligent.cpp
@@ -36,24 +36,26 @@ namespace Diligent
class ImGuiImplDiligent_Internal
{
public:
- ImGuiImplDiligent_Internal(IRenderDevice* pDevice,
- TEXTURE_FORMAT BackBufferFmt,
- TEXTURE_FORMAT DepthBufferFmt,
- Uint32 InitialVertexBufferSize,
- Uint32 InitialIndexBufferSize) :
- m_pDevice (pDevice),
- m_BackBufferFmt (BackBufferFmt),
- m_DepthBufferFmt (DepthBufferFmt),
- m_VertexBufferSize(InitialVertexBufferSize),
- m_IndexBufferSize (InitialIndexBufferSize)
+ ImGuiImplDiligent_Internal(IRenderDevice* pDevice,
+ TEXTURE_FORMAT BackBufferFmt,
+ TEXTURE_FORMAT DepthBufferFmt,
+ Uint32 InitialVertexBufferSize,
+ Uint32 InitialIndexBufferSize) :
+ // clang-format off
+ m_pDevice {pDevice},
+ m_BackBufferFmt {BackBufferFmt},
+ m_DepthBufferFmt {DepthBufferFmt},
+ m_VertexBufferSize{InitialVertexBufferSize},
+ m_IndexBufferSize {InitialIndexBufferSize}
+ // clang-format on
{
// Setup back-end capabilities flags
IMGUI_CHECKVERSION();
ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO();
+ ImGuiIO& io = ImGui::GetIO();
io.BackendRendererName = "ImGuiImplDiligent";
- io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
- io.IniFilename = nullptr;
+ io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
+ io.IniFilename = nullptr;
CreateDeviceObjects();
}
@@ -73,17 +75,17 @@ public:
private:
void CreateFontsTexture();
- RefCntAutoPtr<IRenderDevice> m_pDevice;
- RefCntAutoPtr<IBuffer> m_pVB;
- RefCntAutoPtr<IBuffer> m_pIB;
- RefCntAutoPtr<IBuffer> m_pVertexConstantBuffer;
- RefCntAutoPtr<IPipelineState> m_pPSO;
- RefCntAutoPtr<ITextureView> m_pFontSRV;
- RefCntAutoPtr<IShaderResourceBinding> m_pSRB;
- const TEXTURE_FORMAT m_BackBufferFmt;
- const TEXTURE_FORMAT m_DepthBufferFmt;
- Uint32 m_VertexBufferSize = 0;
- Uint32 m_IndexBufferSize = 0;
+ RefCntAutoPtr<IRenderDevice> m_pDevice;
+ RefCntAutoPtr<IBuffer> m_pVB;
+ RefCntAutoPtr<IBuffer> m_pIB;
+ RefCntAutoPtr<IBuffer> m_pVertexConstantBuffer;
+ RefCntAutoPtr<IPipelineState> m_pPSO;
+ RefCntAutoPtr<ITextureView> m_pFontSRV;
+ RefCntAutoPtr<IShaderResourceBinding> m_pSRB;
+ const TEXTURE_FORMAT m_BackBufferFmt;
+ const TEXTURE_FORMAT m_DepthBufferFmt;
+ Uint32 m_VertexBufferSize = 0;
+ Uint32 m_IndexBufferSize = 0;
};
void ImGuiImplDiligent_Internal::NewFrame()
@@ -173,7 +175,7 @@ void ImGuiImplDiligent_Internal::CreateDeviceObjects()
}
PipelineStateDesc PSODesc;
- PSODesc.Name = "ImGUI PSO";
+ PSODesc.Name = "ImGUI PSO";
auto& GraphicsPipeline = PSODesc.GraphicsPipeline;
GraphicsPipeline.NumRenderTargets = 1;
@@ -188,7 +190,7 @@ void ImGuiImplDiligent_Internal::CreateDeviceObjects()
GraphicsPipeline.RasterizerDesc.ScissorEnable = True;
GraphicsPipeline.DepthStencilDesc.DepthEnable = False;
- auto& RT0 = GraphicsPipeline.BlendDesc.RenderTargets[0];
+ auto& RT0 = GraphicsPipeline.BlendDesc.RenderTargets[0];
RT0.BlendEnable = True;
RT0.SrcBlend = BLEND_FACTOR_SRC_ALPHA;
RT0.DestBlend = BLEND_FACTOR_INV_SRC_ALPHA;
@@ -198,19 +200,19 @@ void ImGuiImplDiligent_Internal::CreateDeviceObjects()
RT0.BlendOpAlpha = BLEND_OPERATION_ADD;
RT0.RenderTargetWriteMask = COLOR_MASK_ALL;
- LayoutElement VSInputs[]
- {
- { 0, 0, 2, VT_FLOAT32}, // pos
- { 1, 0, 2, VT_FLOAT32}, // uv
- { 2, 0, 4, VT_UINT8, True} // col
- };
+ LayoutElement VSInputs[] //
+ {
+ {0, 0, 2, VT_FLOAT32}, // pos
+ {1, 0, 2, VT_FLOAT32}, // uv
+ {2, 0, 4, VT_UINT8, True} // col
+ };
GraphicsPipeline.InputLayout.NumElements = _countof(VSInputs);
GraphicsPipeline.InputLayout.LayoutElements = VSInputs;
ShaderResourceVariableDesc Variables[] =
- {
- {SHADER_TYPE_PIXEL, "Texture", SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE}
- };
+ {
+ {SHADER_TYPE_PIXEL, "Texture", SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE} //
+ };
PSODesc.ResourceLayout.Variables = Variables;
PSODesc.ResourceLayout.NumVariables = _countof(Variables);
@@ -218,10 +220,10 @@ void ImGuiImplDiligent_Internal::CreateDeviceObjects()
SamLinearWrap.AddressU = TEXTURE_ADDRESS_WRAP;
SamLinearWrap.AddressV = TEXTURE_ADDRESS_WRAP;
SamLinearWrap.AddressW = TEXTURE_ADDRESS_WRAP;
- StaticSamplerDesc StaticSamplers[] =
- {
- {SHADER_TYPE_PIXEL, "Texture", SamLinearWrap}
- };
+ StaticSamplerDesc StaticSamplers[] =
+ {
+ {SHADER_TYPE_PIXEL, "Texture", SamLinearWrap} //
+ };
PSODesc.ResourceLayout.StaticSamplers = StaticSamplers;
PSODesc.ResourceLayout.NumStaticSamplers = _countof(StaticSamplers);
@@ -243,9 +245,9 @@ void ImGuiImplDiligent_Internal::CreateDeviceObjects()
void ImGuiImplDiligent_Internal::CreateFontsTexture()
{
// Build texture atlas
- ImGuiIO& io = ImGui::GetIO();
+ ImGuiIO& io = ImGui::GetIO();
unsigned char* pixels = nullptr;
- int width = 0, height = 0;
+ int width = 0, height = 0;
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
TextureDesc FontTexDesc;
@@ -257,8 +259,8 @@ void ImGuiImplDiligent_Internal::CreateFontsTexture()
FontTexDesc.BindFlags = BIND_SHADER_RESOURCE;
FontTexDesc.Usage = USAGE_STATIC;
- TextureSubResData Mip0Data[] = { {pixels, FontTexDesc.Width * 4} };
- TextureData InitData(Mip0Data, _countof(Mip0Data));
+ TextureSubResData Mip0Data[] = {{pixels, FontTexDesc.Width * 4}};
+ TextureData InitData(Mip0Data, _countof(Mip0Data));
RefCntAutoPtr<ITexture> pFontTex;
m_pDevice->CreateTexture(FontTexDesc, &InitData, &pFontTex);
@@ -278,12 +280,12 @@ void ImGuiImplDiligent_Internal::RenderDrawData(IDeviceContext* pCtx, ImDrawData
// Avoid rendering when minimized
if (pDrawData->DisplaySize.x <= 0.0f || pDrawData->DisplaySize.y <= 0.0f)
return;
-
+
// Create and grow vertex/index buffers if needed
if (!m_pVB || static_cast<int>(m_VertexBufferSize) < pDrawData->TotalVtxCount)
{
m_pVB.Release();
- while(static_cast<int>(m_VertexBufferSize) < pDrawData->TotalVtxCount)
+ while (static_cast<int>(m_VertexBufferSize) < pDrawData->TotalVtxCount)
m_VertexBufferSize *= 2;
BufferDesc VBDesc;
@@ -294,11 +296,11 @@ void ImGuiImplDiligent_Internal::RenderDrawData(IDeviceContext* pCtx, ImDrawData
VBDesc.CPUAccessFlags = CPU_ACCESS_WRITE;
m_pDevice->CreateBuffer(VBDesc, nullptr, &m_pVB);
}
-
+
if (!m_pIB || static_cast<int>(m_IndexBufferSize) < pDrawData->TotalIdxCount)
{
m_pIB.Release();
- while(static_cast<int>(m_IndexBufferSize) < pDrawData->TotalIdxCount)
+ while (static_cast<int>(m_IndexBufferSize) < pDrawData->TotalIdxCount)
m_IndexBufferSize *= 2;
BufferDesc IBDesc;
@@ -312,9 +314,10 @@ void ImGuiImplDiligent_Internal::RenderDrawData(IDeviceContext* pCtx, ImDrawData
{
MapHelper<ImDrawVert> Verices(pCtx, m_pVB, MAP_WRITE, MAP_FLAG_DISCARD);
- MapHelper<ImDrawIdx> Indices(pCtx, m_pIB, MAP_WRITE, MAP_FLAG_DISCARD);
+ MapHelper<ImDrawIdx> Indices(pCtx, m_pIB, MAP_WRITE, MAP_FLAG_DISCARD);
+
ImDrawVert* vtx_dst = Verices;
- ImDrawIdx* idx_dst = Indices;
+ ImDrawIdx* idx_dst = Indices;
for (int n = 0; n < pDrawData->CmdListsCount; n++)
{
const ImDrawList* cmd_list = pDrawData->CmdLists[n];
@@ -331,32 +334,35 @@ void ImGuiImplDiligent_Internal::RenderDrawData(IDeviceContext* pCtx, ImDrawData
// DisplayPos is (0,0) for single viewport apps.
{
MapHelper<float4x4> CBData(pCtx, m_pVertexConstantBuffer, MAP_WRITE, MAP_FLAG_DISCARD);
+
float L = pDrawData->DisplayPos.x;
float R = pDrawData->DisplayPos.x + pDrawData->DisplaySize.x;
float T = pDrawData->DisplayPos.y;
float B = pDrawData->DisplayPos.y + pDrawData->DisplaySize.y;
+ // clang-format off
*CBData = float4x4
{
- 2.0f/(R-L), 0.0f, 0.0f, 0.0f,
- 0.0f, 2.0f/(T-B), 0.0f, 0.0f,
- 0.0f, 0.0f, 0.5f, 0.0f,
- (R+L)/(L-R), (T+B)/(B-T), 0.5f, 1.0f
+ 2.0f / (R - L), 0.0f, 0.0f, 0.0f,
+ 0.0f, 2.0f / (T - B), 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.5f, 0.0f,
+ (R + L) / (L - R), (T + B) / (B - T), 0.5f, 1.0f
};
+ // clang-format on
}
- auto DisplayWidth = static_cast<Uint32>(pDrawData->DisplaySize.x);
- auto DisplayHeight = static_cast<Uint32>(pDrawData->DisplaySize.y);
- auto SetupRenderState = [&]()
+ auto DisplayWidth = static_cast<Uint32>(pDrawData->DisplaySize.x);
+ auto DisplayHeight = static_cast<Uint32>(pDrawData->DisplaySize.y);
+ auto SetupRenderState = [&]() //
{
// Setup shader and vertex buffers
- Uint32 Offsets[] = {0};
- IBuffer* pVBs[] = {m_pVB};
+ Uint32 Offsets[] = {0};
+ IBuffer* pVBs[] = {m_pVB};
pCtx->SetVertexBuffers(0, 1, pVBs, Offsets, RESOURCE_STATE_TRANSITION_MODE_TRANSITION, SET_VERTEX_BUFFERS_FLAG_RESET);
pCtx->SetIndexBuffer(m_pIB, 0, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
pCtx->SetPipelineState(m_pPSO);
pCtx->CommitShaderResources(m_pSRB, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
- const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };
+ const float blend_factor[4] = {0.f, 0.f, 0.f, 0.f};
pCtx->SetBlendFactors(blend_factor);
Viewport vp;
@@ -367,13 +373,14 @@ void ImGuiImplDiligent_Internal::RenderDrawData(IDeviceContext* pCtx, ImDrawData
vp.TopLeftX = vp.TopLeftY = 0;
pCtx->SetViewports(1, &vp, DisplayWidth, DisplayHeight);
};
-
+
SetupRenderState();
// Render command lists
// (Because we merged all buffers into a single one, we maintain our own offset into them)
int global_idx_offset = 0;
int global_vtx_offset = 0;
+
ImVec2 clip_off = pDrawData->DisplayPos;
for (int n = 0; n < pDrawData->CmdListsCount; n++)
{
@@ -394,17 +401,18 @@ void ImGuiImplDiligent_Internal::RenderDrawData(IDeviceContext* pCtx, ImDrawData
{
// Apply scissor/clipping rectangle
const Rect r =
- {
- static_cast<Int32>(pcmd->ClipRect.x - clip_off.x),
- static_cast<Int32>(pcmd->ClipRect.y - clip_off.y),
- static_cast<Int32>(pcmd->ClipRect.z - clip_off.x),
- static_cast<Int32>(pcmd->ClipRect.w - clip_off.y)
- };
+ {
+ static_cast<Int32>(pcmd->ClipRect.x - clip_off.x),
+ static_cast<Int32>(pcmd->ClipRect.y - clip_off.y),
+ static_cast<Int32>(pcmd->ClipRect.z - clip_off.x),
+ static_cast<Int32>(pcmd->ClipRect.w - clip_off.y) //
+ };
pCtx->SetScissorRects(1, &r, DisplayWidth, DisplayHeight);
// Bind texture, Draw
auto* texture_srv = reinterpret_cast<ITextureView*>(pcmd->TextureId);
- VERIFY_EXPR(texture_srv == m_pFontSRV); (void)texture_srv;
+ VERIFY_EXPR(texture_srv == m_pFontSRV);
+ (void)texture_srv;
//ctx->PSSetShaderResources(0, 1, &texture_srv);
DrawIndexedAttribs DrawAttrs(pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? VT_UINT16 : VT_UINT32, DRAW_FLAG_VERIFY_STATES);
DrawAttrs.FirstIndexLocation = pcmd->IdxOffset + global_idx_offset;
@@ -419,11 +427,11 @@ void ImGuiImplDiligent_Internal::RenderDrawData(IDeviceContext* pCtx, ImDrawData
-ImGuiImplDiligent::ImGuiImplDiligent(IRenderDevice* pDevice,
- TEXTURE_FORMAT BackBufferFmt,
- TEXTURE_FORMAT DepthBufferFmt,
- Uint32 InitialVertexBufferSize,
- Uint32 InitialIndexBufferSize) :
+ImGuiImplDiligent::ImGuiImplDiligent(IRenderDevice* pDevice,
+ TEXTURE_FORMAT BackBufferFmt,
+ TEXTURE_FORMAT DepthBufferFmt,
+ Uint32 InitialVertexBufferSize,
+ Uint32 InitialIndexBufferSize) :
m_pImpl(new ImGuiImplDiligent_Internal(pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize))
{
}
@@ -444,7 +452,7 @@ void ImGuiImplDiligent::Render(IDeviceContext* pCtx)
m_pImpl->RenderDrawData(pCtx, ImGui::GetDrawData());
}
- // Use if you want to reset your rendering device without losing ImGui state.
+// Use if you want to reset your rendering device without losing ImGui state.
void ImGuiImplDiligent::InvalidateDeviceObjects()
{
m_pImpl->InvalidateDeviceObjects();
@@ -455,6 +463,4 @@ void ImGuiImplDiligent::CreateDeviceObjects()
m_pImpl->CreateDeviceObjects();
}
-}
-
-
+} // namespace Diligent
diff --git a/Imgui/src/ImGuiImplLinuxX11.cpp b/Imgui/src/ImGuiImplLinuxX11.cpp
index 2497978..bf0b74f 100644
--- a/Imgui/src/ImGuiImplLinuxX11.cpp
+++ b/Imgui/src/ImGuiImplLinuxX11.cpp
@@ -26,15 +26,15 @@
#include <X11/Xutil.h>
#ifdef Bool
-# undef Bool
+# undef Bool
#endif
#ifdef True
-# undef True
+# undef True
#endif
#ifdef False
-# undef False
+# undef False
#endif
@@ -45,44 +45,44 @@
namespace Diligent
{
-ImGuiImplLinuxX11::ImGuiImplLinuxX11(IRenderDevice* pDevice,
- TEXTURE_FORMAT BackBufferFmt,
- TEXTURE_FORMAT DepthBufferFmt,
- Uint32 DisplayWidth,
- Uint32 DisplayHeight,
- Uint32 InitialVertexBufferSize,
- Uint32 InitialIndexBufferSize) :
- ImGuiImplDiligent(pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize)
+ImGuiImplLinuxX11::ImGuiImplLinuxX11(IRenderDevice* pDevice,
+ TEXTURE_FORMAT BackBufferFmt,
+ TEXTURE_FORMAT DepthBufferFmt,
+ Uint32 DisplayWidth,
+ Uint32 DisplayHeight,
+ Uint32 InitialVertexBufferSize,
+ Uint32 InitialIndexBufferSize) :
+ ImGuiImplDiligent(pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize)
{
- auto& io = ImGui::GetIO();
+ auto& io = ImGui::GetIO();
io.DisplaySize = ImVec2(DisplayWidth, DisplayHeight);
-
+
io.BackendPlatformName = "Diligent-ImGuiImplLinuxX11";
-
+
// Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array that we will update during the application lifetime.
- io.KeyMap[ImGuiKey_Tab] = 256;
- io.KeyMap[ImGuiKey_LeftArrow] = 257;
- io.KeyMap[ImGuiKey_RightArrow] = 258;
- io.KeyMap[ImGuiKey_UpArrow] = 259;
- io.KeyMap[ImGuiKey_DownArrow] = 260;
- io.KeyMap[ImGuiKey_PageUp] = 261;
- io.KeyMap[ImGuiKey_PageDown] = 262;
- io.KeyMap[ImGuiKey_Home] = 263;
- io.KeyMap[ImGuiKey_End] = 264;
- io.KeyMap[ImGuiKey_Insert] = 265;
- io.KeyMap[ImGuiKey_Delete] = 266;
- io.KeyMap[ImGuiKey_Backspace] = 267;
- io.KeyMap[ImGuiKey_Space] = 268;
- io.KeyMap[ImGuiKey_Enter] = 269;
+ io.KeyMap[ImGuiKey_Tab] = 256;
+ io.KeyMap[ImGuiKey_LeftArrow] = 257;
+ io.KeyMap[ImGuiKey_RightArrow] = 258;
+ io.KeyMap[ImGuiKey_UpArrow] = 259;
+ io.KeyMap[ImGuiKey_DownArrow] = 260;
+ io.KeyMap[ImGuiKey_PageUp] = 261;
+ io.KeyMap[ImGuiKey_PageDown] = 262;
+ io.KeyMap[ImGuiKey_Home] = 263;
+ io.KeyMap[ImGuiKey_End] = 264;
+ io.KeyMap[ImGuiKey_Insert] = 265;
+ io.KeyMap[ImGuiKey_Delete] = 266;
+ io.KeyMap[ImGuiKey_Backspace] = 267;
+ io.KeyMap[ImGuiKey_Space] = 268;
+ io.KeyMap[ImGuiKey_Enter] = 269;
//io.KeyMap[ImGuiKey_Escape] = 270;
io.KeyMap[ImGuiKey_KeyPadEnter] = 271;
- io.KeyMap[ImGuiKey_A] = 'A';
- io.KeyMap[ImGuiKey_C] = 'C';
- io.KeyMap[ImGuiKey_V] = 'V';
- io.KeyMap[ImGuiKey_X] = 'X';
- io.KeyMap[ImGuiKey_Y] = 'Y';
- io.KeyMap[ImGuiKey_Z] = 'Z';
+ io.KeyMap[ImGuiKey_A] = 'A';
+ io.KeyMap[ImGuiKey_C] = 'C';
+ io.KeyMap[ImGuiKey_V] = 'V';
+ io.KeyMap[ImGuiKey_X] = 'X';
+ io.KeyMap[ImGuiKey_Y] = 'Y';
+ io.KeyMap[ImGuiKey_Z] = 'Z';
m_LastTimestamp = std::chrono::high_resolution_clock::now();
}
@@ -93,11 +93,11 @@ ImGuiImplLinuxX11::~ImGuiImplLinuxX11()
void ImGuiImplLinuxX11::NewFrame()
{
- auto now = std::chrono::high_resolution_clock::now();
- auto elapsed_ns = now - m_LastTimestamp;
+ auto now = std::chrono::high_resolution_clock::now();
+ auto elapsed_ns = now - m_LastTimestamp;
m_LastTimestamp = now;
- auto& io = ImGui::GetIO();
- io.DeltaTime = static_cast<float>(elapsed_ns.count() / 1e+9);
+ auto& io = ImGui::GetIO();
+ io.DeltaTime = static_cast<float>(elapsed_ns.count() / 1e+9);
ImGuiImplDiligent::NewFrame();
}
@@ -111,9 +111,9 @@ bool ImGuiImplLinuxX11::HandleXEvent(XEvent* event)
case ButtonPress:
case ButtonRelease:
{
- bool IsPressed = event->type == ButtonPress;
- auto* xbe = reinterpret_cast<XButtonEvent *>(event);
- switch(xbe->button)
+ bool IsPressed = event->type == ButtonPress;
+ auto* xbe = reinterpret_cast<XButtonEvent*>(event);
+ switch (xbe->button)
{
case Button1: io.MouseDown[0] = IsPressed; break; // Left
case Button2: io.MouseDown[2] = IsPressed; break; // Middle
@@ -126,33 +126,34 @@ bool ImGuiImplLinuxX11::HandleXEvent(XEvent* event)
case MotionNotify:
{
- XMotionEvent* xme = (XMotionEvent *)event;
- io.MousePos = ImVec2(xme->x, xme->y);
+ XMotionEvent* xme = (XMotionEvent*)event;
+ io.MousePos = ImVec2(xme->x, xme->y);
return io.WantCaptureMouse;
}
case ConfigureNotify:
{
- XConfigureEvent *xce = (XConfigureEvent *)event;
- io.DisplaySize = ImVec2(xce->width, xce->height);
+ XConfigureEvent* xce = (XConfigureEvent*)event;
+ io.DisplaySize = ImVec2(xce->width, xce->height);
return false;
}
case KeyPress:
- case KeyRelease:
+ case KeyRelease:
{
bool IsPressed = event->type == KeyPress;
- io.KeyCtrl = (event->xkey.state & ControlMask) != 0;
- io.KeyShift = (event->xkey.state & ShiftMask) != 0;
- io.KeyAlt = (event->xkey.state & Mod1Mask) != 0;
+ io.KeyCtrl = (event->xkey.state & ControlMask) != 0;
+ io.KeyShift = (event->xkey.state & ShiftMask) != 0;
+ io.KeyAlt = (event->xkey.state & Mod1Mask) != 0;
- KeySym keysym = 0;
+ KeySym keysym = 0;
constexpr int buff_sz = 80;
- char buffer[buff_sz];
- int num_char = XLookupString((XKeyEvent *)event, buffer, buff_sz, &keysym, 0);
- int k = 0;
- switch(keysym)
+ char buffer[buff_sz];
+ int num_char = XLookupString((XKeyEvent*)event, buffer, buff_sz, &keysym, 0);
+ int k = 0;
+ switch (keysym)
{
+ // clang-format off
case XK_Tab: k = io.KeyMap[ImGuiKey_Tab]; break;
case XK_Left: k = io.KeyMap[ImGuiKey_LeftArrow]; break;
case XK_Right: k = io.KeyMap[ImGuiKey_RightArrow]; break;
@@ -169,24 +170,25 @@ bool ImGuiImplLinuxX11::HandleXEvent(XEvent* event)
case XK_Return: k = io.KeyMap[ImGuiKey_Enter]; break;
case XK_Escape: k = io.KeyMap[ImGuiKey_Escape]; break;
case XK_KP_Enter: k = io.KeyMap[ImGuiKey_KeyPadEnter];break;
+ // clang-format on
}
- if (k!=0)
+ if (k != 0)
io.KeysDown[k] = IsPressed;
if (k == 0 && IsPressed)
{
- for (int i=0; i < num_char; ++i)
+ for (int i = 0; i < num_char; ++i)
io.AddInputCharacter(buffer[i]);
}
return io.WantCaptureKeyboard;
}
- default:
+ default:
break;
}
- return false;
+ return false;
}
-}
+} // namespace Diligent
diff --git a/Imgui/src/ImGuiImplLinuxXCB.cpp b/Imgui/src/ImGuiImplLinuxXCB.cpp
index 5e73702..3470c00 100644
--- a/Imgui/src/ImGuiImplLinuxXCB.cpp
+++ b/Imgui/src/ImGuiImplLinuxXCB.cpp
@@ -28,15 +28,15 @@
#include "xcb_keysyms/xcb_keysyms.h"
#ifdef Bool
-# undef Bool
+# undef Bool
#endif
#ifdef True
-# undef True
+# undef True
#endif
#ifdef False
-# undef False
+# undef False
#endif
#include "ImGuiImplLinuxXCB.h"
@@ -52,38 +52,38 @@ ImGuiImplLinuxXCB::ImGuiImplLinuxXCB(xcb_connection_t* connection,
Uint32 DisplayHeight,
Uint32 InitialVertexBufferSize,
Uint32 InitialIndexBufferSize) :
- ImGuiImplDiligent(pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize)
+ ImGuiImplDiligent{pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize}
{
m_syms = xcb_key_symbols_alloc((xcb_connection_t*)connection);
- auto& io = ImGui::GetIO();
+ auto& io = ImGui::GetIO();
io.DisplaySize = ImVec2(DisplayWidth, DisplayHeight);
-
+
io.BackendPlatformName = "Diligent-ImGuiImplLinuxXCB";
// Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array that we will update during the application lifetime.
- io.KeyMap[ImGuiKey_Tab] = 0x17;
- io.KeyMap[ImGuiKey_LeftArrow] = 0x71;
- io.KeyMap[ImGuiKey_RightArrow] = 0x72;
- io.KeyMap[ImGuiKey_UpArrow] = 0x6F;
- io.KeyMap[ImGuiKey_DownArrow] = 0x74;
- io.KeyMap[ImGuiKey_PageUp] = 0x70;
- io.KeyMap[ImGuiKey_PageDown] = 0x75;
- io.KeyMap[ImGuiKey_Home] = 0x6E;
- io.KeyMap[ImGuiKey_End] = 0x73;
- io.KeyMap[ImGuiKey_Insert] = 0x76;
- io.KeyMap[ImGuiKey_Delete] = 0x77;
- io.KeyMap[ImGuiKey_Backspace] = 0x16;
+ io.KeyMap[ImGuiKey_Tab] = 0x17;
+ io.KeyMap[ImGuiKey_LeftArrow] = 0x71;
+ io.KeyMap[ImGuiKey_RightArrow] = 0x72;
+ io.KeyMap[ImGuiKey_UpArrow] = 0x6F;
+ io.KeyMap[ImGuiKey_DownArrow] = 0x74;
+ io.KeyMap[ImGuiKey_PageUp] = 0x70;
+ io.KeyMap[ImGuiKey_PageDown] = 0x75;
+ io.KeyMap[ImGuiKey_Home] = 0x6E;
+ io.KeyMap[ImGuiKey_End] = 0x73;
+ io.KeyMap[ImGuiKey_Insert] = 0x76;
+ io.KeyMap[ImGuiKey_Delete] = 0x77;
+ io.KeyMap[ImGuiKey_Backspace] = 0x16;
//io.KeyMap[ImGuiKey_Space] = 0;//VK_SPACE;
io.KeyMap[ImGuiKey_Enter] = 0x24;
io.KeyMap[ImGuiKey_Escape] = 0x09;
io.KeyMap[ImGuiKey_KeyPadEnter] = 0x68;
- io.KeyMap[ImGuiKey_A] = 'A';
- io.KeyMap[ImGuiKey_C] = 'C';
- io.KeyMap[ImGuiKey_V] = 'V';
- io.KeyMap[ImGuiKey_X] = 'X';
- io.KeyMap[ImGuiKey_Y] = 'Y';
- io.KeyMap[ImGuiKey_Z] = 'Z';
+ io.KeyMap[ImGuiKey_A] = 'A';
+ io.KeyMap[ImGuiKey_C] = 'C';
+ io.KeyMap[ImGuiKey_V] = 'V';
+ io.KeyMap[ImGuiKey_X] = 'X';
+ io.KeyMap[ImGuiKey_Y] = 'Y';
+ io.KeyMap[ImGuiKey_Z] = 'Z';
m_LastTimestamp = std::chrono::high_resolution_clock::now();
}
@@ -98,11 +98,11 @@ ImGuiImplLinuxXCB::~ImGuiImplLinuxXCB()
void ImGuiImplLinuxXCB::NewFrame()
{
- auto now = std::chrono::high_resolution_clock::now();
- auto elapsed_ns = now - m_LastTimestamp;
+ auto now = std::chrono::high_resolution_clock::now();
+ auto elapsed_ns = now - m_LastTimestamp;
m_LastTimestamp = now;
- auto& io = ImGui::GetIO();
- io.DeltaTime = static_cast<float>(elapsed_ns.count() / 1e+9);
+ auto& io = ImGui::GetIO();
+ io.DeltaTime = static_cast<float>(elapsed_ns.count() / 1e+9);
ImGuiImplDiligent::NewFrame();
}
@@ -119,9 +119,10 @@ void ImGuiImplLinuxXCB::HandleKeyEvent(xcb_key_release_event_t* event)
io.KeyShift = event->state & XCB_KEY_BUT_MASK_SHIFT;
io.KeyAlt = event->state & XCB_KEY_BUT_MASK_MOD_1;
- int k = 0;
- switch (event->detail)
- {
+ int k = 0;
+ switch (event->detail)
+ {
+ // clang-format off
case 0x09: k = io.KeyMap[ImGuiKey_Escape]; break;
case 0x6F: k = io.KeyMap[ImGuiKey_UpArrow]; break;
case 0x74: k = io.KeyMap[ImGuiKey_DownArrow]; break;
@@ -137,9 +138,10 @@ void ImGuiImplLinuxXCB::HandleKeyEvent(xcb_key_release_event_t* event)
case 0x68: k = io.KeyMap[ImGuiKey_KeyPadEnter];break;
case 0x70: k = io.KeyMap[ImGuiKey_PageUp]; break;
case 0x75: k = io.KeyMap[ImGuiKey_PageDown]; break;
- }
+ // clang-format on
+ }
- if(k == 0 && IsKeyPressed)
+ if (k == 0 && IsKeyPressed)
{
xcb_keysym_t keysym = xcb_key_press_lookup_keysym(m_syms, event, 0);
switch (keysym)
@@ -154,31 +156,31 @@ void ImGuiImplLinuxXCB::HandleKeyEvent(xcb_key_release_event_t* event)
case XK_Alt_L:
case XK_Alt_R: /*s_KMod |= TW_KMOD_ALT;*/ break;
-#ifdef XK_Enter
+# ifdef XK_Enter
case XK_Enter: k = TW_KEY_RETURN; break;
-#endif
+# endif
-#ifdef XK_KP_Home
+# ifdef XK_KP_Home
case XK_KP_Home: k = io.KeyMap[ImGuiKey_Home]; break;
case XK_KP_End: k = io.KeyMap[ImGuiKey_End]; break;
case XK_KP_Delete: k = io.KeyMap[ImGuiKey_Delete]; break;
-#endif
+# endif
-#ifdef XK_KP_Up
+# ifdef XK_KP_Up
case XK_KP_Up: k = io.KeyMap[ImGuiKey_UpArrow]; break;
case XK_KP_Down: k = io.KeyMap[ImGuiKey_DownArrow]; break;
case XK_KP_Right: k = io.KeyMap[ImGuiKey_RightArrow]; break;
case XK_KP_Left: k = io.KeyMap[ImGuiKey_LeftArrow]; break;
-#endif
+# endif
-#ifdef XK_KP_Page_Up
+# ifdef XK_KP_Page_Up
case XK_KP_Page_Up: k = io.KeyMap[ImGuiKey_PageUp]; break;
case XK_KP_Page_Down: k = io.KeyMap[ImGuiKey_PageDown]; break;
-#endif
+# endif
-#ifdef XK_KP_Tab
+# ifdef XK_KP_Tab
case XK_KP_Tab: k = io.KeyMap[ImGuiKey_Tab]; break;
-#endif
+# endif
#endif
default:
if (keysym > 12 && keysym < 127)
@@ -189,29 +191,29 @@ void ImGuiImplLinuxXCB::HandleKeyEvent(xcb_key_release_event_t* event)
keysym += (int)'A' - (int)'a';
else
{
- switch(keysym)
+ switch (keysym)
{
- case '`': keysym = '~'; break;
- case '1': keysym = '!'; break;
- case '2': keysym = '@'; break;
- case '3': keysym = '#'; break;
- case '4': keysym = '$'; break;
- case '5': keysym = '%'; break;
- case '6': keysym = '^'; break;
- case '7': keysym = '&'; break;
- case '8': keysym = '*'; break;
- case '9': keysym = '('; break;
- case '0': keysym = ')'; break;
- case '-': keysym = '_'; break;
- case '=': keysym = '+'; break;
- case '[': keysym = '{'; break;
- case ']': keysym = '}'; break;
+ case '`': keysym = '~'; break;
+ case '1': keysym = '!'; break;
+ case '2': keysym = '@'; break;
+ case '3': keysym = '#'; break;
+ case '4': keysym = '$'; break;
+ case '5': keysym = '%'; break;
+ case '6': keysym = '^'; break;
+ case '7': keysym = '&'; break;
+ case '8': keysym = '*'; break;
+ case '9': keysym = '('; break;
+ case '0': keysym = ')'; break;
+ case '-': keysym = '_'; break;
+ case '=': keysym = '+'; break;
+ case '[': keysym = '{'; break;
+ case ']': keysym = '}'; break;
case '\\': keysym = '|'; break;
- case ';': keysym = ':'; break;
+ case ';': keysym = ':'; break;
case '\'': keysym = '\"'; break;
- case ',': keysym = '<'; break;
- case '.': keysym = '>'; break;
- case '/': keysym = '?'; break;
+ case ',': keysym = '<'; break;
+ case '.': keysym = '>'; break;
+ case '/': keysym = '?'; break;
}
}
}
@@ -234,15 +236,15 @@ bool ImGuiImplLinuxXCB::HandleXCBEvent(xcb_generic_event_t* event)
{
case XCB_MOTION_NOTIFY:
{
- xcb_motion_notify_event_t *motion = (xcb_motion_notify_event_t *)event;
- io.MousePos = ImVec2(motion->event_x, motion->event_y);
+ xcb_motion_notify_event_t* motion = (xcb_motion_notify_event_t*)event;
+ io.MousePos = ImVec2(motion->event_x, motion->event_y);
return io.WantCaptureMouse;
}
break;
case XCB_BUTTON_PRESS:
{
- xcb_button_press_event_t *press = (xcb_button_press_event_t *)event;
+ xcb_button_press_event_t* press = (xcb_button_press_event_t*)event;
switch (press->detail)
{
case XCB_BUTTON_INDEX_1: io.MouseDown[0] = true; break; // left
@@ -251,14 +253,14 @@ bool ImGuiImplLinuxXCB::HandleXCBEvent(xcb_generic_event_t* event)
case XCB_BUTTON_INDEX_4: io.MouseWheel += 1; break;
case XCB_BUTTON_INDEX_5: io.MouseWheel -= 1; break;
}
-
+
return io.WantCaptureMouse;
}
break;
case XCB_BUTTON_RELEASE:
{
- xcb_button_release_event_t *press = (xcb_button_release_event_t *)event;
+ xcb_button_release_event_t* press = (xcb_button_release_event_t*)event;
switch (press->detail)
{
case XCB_BUTTON_INDEX_1: io.MouseDown[0] = false; break; // left
@@ -273,7 +275,7 @@ bool ImGuiImplLinuxXCB::HandleXCBEvent(xcb_generic_event_t* event)
case XCB_KEY_RELEASE:
case XCB_KEY_PRESS:
{
- xcb_key_press_event_t* keyEvent = (xcb_key_press_event_t *)event;
+ xcb_key_press_event_t* keyEvent = (xcb_key_press_event_t*)event;
HandleKeyEvent(keyEvent);
return io.WantCaptureKeyboard;
}
@@ -281,7 +283,8 @@ bool ImGuiImplLinuxXCB::HandleXCBEvent(xcb_generic_event_t* event)
case XCB_CONFIGURE_NOTIFY:
{
- const xcb_configure_notify_event_t *cfgEvent = (const xcb_configure_notify_event_t *)event;
+ const xcb_configure_notify_event_t* cfgEvent = (const xcb_configure_notify_event_t*)event;
+
io.DisplaySize = ImVec2(cfgEvent->width, cfgEvent->height);
return false;
}
@@ -294,4 +297,4 @@ bool ImGuiImplLinuxXCB::HandleXCBEvent(xcb_generic_event_t* event)
return false;
}
-}
+} // namespace Diligent
diff --git a/Imgui/src/ImGuiImplUWP.cpp b/Imgui/src/ImGuiImplUWP.cpp
index b09f318..d85af42 100644
--- a/Imgui/src/ImGuiImplUWP.cpp
+++ b/Imgui/src/ImGuiImplUWP.cpp
@@ -22,7 +22,7 @@
*/
#ifndef NOMINMAX
-# define NOMINMAX
+# define NOMINMAX
#endif
#include <wrl.h>
#include <wrl/client.h>
@@ -34,47 +34,47 @@
namespace Diligent
{
-ImGuiImplUWP::ImGuiImplUWP(IRenderDevice* pDevice,
- TEXTURE_FORMAT BackBufferFmt,
- TEXTURE_FORMAT DepthBufferFmt,
- Uint32 DisplayWidth,
- Uint32 DisplayHeight,
- Uint32 InitialVertexBufferSize,
- Uint32 InitialIndexBufferSize) :
- ImGuiImplDiligent(pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize),
- m_DisplayWidth (DisplayWidth),
- m_DisplayHeight (DisplayHeight)
+ImGuiImplUWP::ImGuiImplUWP(IRenderDevice* pDevice,
+ TEXTURE_FORMAT BackBufferFmt,
+ TEXTURE_FORMAT DepthBufferFmt,
+ Uint32 DisplayWidth,
+ Uint32 DisplayHeight,
+ Uint32 InitialVertexBufferSize,
+ Uint32 InitialIndexBufferSize) :
+ ImGuiImplDiligent{pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize},
+ m_DisplayWidth{DisplayWidth},
+ m_DisplayHeight{DisplayHeight}
{
- ::QueryPerformanceFrequency((LARGE_INTEGER *)&m_TicksPerSecond);
- ::QueryPerformanceCounter((LARGE_INTEGER *)&m_Time);
+ ::QueryPerformanceFrequency((LARGE_INTEGER*)&m_TicksPerSecond);
+ ::QueryPerformanceCounter((LARGE_INTEGER*)&m_Time);
// Setup back-end capabilities flags
- ImGuiIO& io = ImGui::GetIO();
+ ImGuiIO& io = ImGui::GetIO();
io.BackendPlatformName = "imgui_impl_uwp";
// Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array that we will update during the application lifetime.
- io.KeyMap[ImGuiKey_Tab] = VK_TAB;
- io.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;
- io.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;
- io.KeyMap[ImGuiKey_UpArrow] = VK_UP;
- io.KeyMap[ImGuiKey_DownArrow] = VK_DOWN;
- io.KeyMap[ImGuiKey_PageUp] = VK_PRIOR;
- io.KeyMap[ImGuiKey_PageDown] = VK_NEXT;
- io.KeyMap[ImGuiKey_Home] = VK_HOME;
- io.KeyMap[ImGuiKey_End] = VK_END;
- io.KeyMap[ImGuiKey_Insert] = VK_INSERT;
- io.KeyMap[ImGuiKey_Delete] = VK_DELETE;
- io.KeyMap[ImGuiKey_Backspace] = VK_BACK;
- io.KeyMap[ImGuiKey_Space] = VK_SPACE;
- io.KeyMap[ImGuiKey_Enter] = VK_RETURN;
- io.KeyMap[ImGuiKey_Escape] = VK_ESCAPE;
+ io.KeyMap[ImGuiKey_Tab] = VK_TAB;
+ io.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;
+ io.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;
+ io.KeyMap[ImGuiKey_UpArrow] = VK_UP;
+ io.KeyMap[ImGuiKey_DownArrow] = VK_DOWN;
+ io.KeyMap[ImGuiKey_PageUp] = VK_PRIOR;
+ io.KeyMap[ImGuiKey_PageDown] = VK_NEXT;
+ io.KeyMap[ImGuiKey_Home] = VK_HOME;
+ io.KeyMap[ImGuiKey_End] = VK_END;
+ io.KeyMap[ImGuiKey_Insert] = VK_INSERT;
+ io.KeyMap[ImGuiKey_Delete] = VK_DELETE;
+ io.KeyMap[ImGuiKey_Backspace] = VK_BACK;
+ io.KeyMap[ImGuiKey_Space] = VK_SPACE;
+ io.KeyMap[ImGuiKey_Enter] = VK_RETURN;
+ io.KeyMap[ImGuiKey_Escape] = VK_ESCAPE;
io.KeyMap[ImGuiKey_KeyPadEnter] = VK_RETURN;
- io.KeyMap[ImGuiKey_A] = 'A';
- io.KeyMap[ImGuiKey_C] = 'C';
- io.KeyMap[ImGuiKey_V] = 'V';
- io.KeyMap[ImGuiKey_X] = 'X';
- io.KeyMap[ImGuiKey_Y] = 'Y';
- io.KeyMap[ImGuiKey_Z] = 'Z';
+ io.KeyMap[ImGuiKey_A] = 'A';
+ io.KeyMap[ImGuiKey_C] = 'C';
+ io.KeyMap[ImGuiKey_V] = 'V';
+ io.KeyMap[ImGuiKey_X] = 'X';
+ io.KeyMap[ImGuiKey_Y] = 'Y';
+ io.KeyMap[ImGuiKey_Z] = 'Z';
}
ImGuiImplUWP::~ImGuiImplUWP()
@@ -90,13 +90,13 @@ void ImGuiImplUWP::NewFrame()
// Setup time step
INT64 current_time;
- ::QueryPerformanceCounter((LARGE_INTEGER *)&current_time);
+ ::QueryPerformanceCounter((LARGE_INTEGER*)&current_time);
io.DeltaTime = (float)(current_time - m_Time) / m_TicksPerSecond;
- m_Time = current_time;
+ m_Time = current_time;
io.KeySuper = false;
ImGuiImplDiligent::NewFrame();
}
-}
+} // namespace Diligent
diff --git a/Imgui/src/ImGuiImplWin32.cpp b/Imgui/src/ImGuiImplWin32.cpp
index 58f3f6e..f665b5e 100644
--- a/Imgui/src/ImGuiImplWin32.cpp
+++ b/Imgui/src/ImGuiImplWin32.cpp
@@ -22,7 +22,7 @@
*/
#ifndef NOMINMAX
-# define NOMINMAX
+# define NOMINMAX
#endif
#include <Windows.h>
@@ -35,13 +35,13 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA
namespace Diligent
{
-ImGuiImplWin32::ImGuiImplWin32(HWND hWnd,
- IRenderDevice* pDevice,
- TEXTURE_FORMAT BackBufferFmt,
- TEXTURE_FORMAT DepthBufferFmt,
- Uint32 InitialVertexBufferSize,
- Uint32 InitialIndexBufferSize) :
- ImGuiImplDiligent(pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize)
+ImGuiImplWin32::ImGuiImplWin32(HWND hWnd,
+ IRenderDevice* pDevice,
+ TEXTURE_FORMAT BackBufferFmt,
+ TEXTURE_FORMAT DepthBufferFmt,
+ Uint32 InitialVertexBufferSize,
+ Uint32 InitialIndexBufferSize) :
+ ImGuiImplDiligent{pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize}
{
ImGui_ImplWin32_Init(hWnd);
}
@@ -67,10 +67,14 @@ LRESULT ImGuiImplWin32::Win32_ProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LP
ImGuiIO& io = ImGui::GetIO();
switch (msg)
{
- case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK:
- case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK:
- case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK:
- case WM_XBUTTONDOWN: case WM_XBUTTONDBLCLK:
+ case WM_LBUTTONDOWN:
+ case WM_LBUTTONDBLCLK:
+ case WM_RBUTTONDOWN:
+ case WM_RBUTTONDBLCLK:
+ case WM_MBUTTONDOWN:
+ case WM_MBUTTONDBLCLK:
+ case WM_XBUTTONDOWN:
+ case WM_XBUTTONDBLCLK:
case WM_LBUTTONUP:
case WM_RBUTTONUP:
case WM_MBUTTONUP:
@@ -92,4 +96,4 @@ LRESULT ImGuiImplWin32::Win32_ProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LP
return res;
}
-}
+} // namespace Diligent