Add wrapper for ImGui mouse handling.

This commit is contained in:
Bartosz Taudul 2020-08-01 11:49:43 +02:00
parent 90e01a4888
commit 733b9c4048
4 changed files with 50 additions and 0 deletions

View File

@ -119,6 +119,7 @@
<ClCompile Include="..\..\..\server\TracyMemory.cpp" />
<ClCompile Include="..\..\..\server\TracyMicroArchitecture.cpp" />
<ClCompile Include="..\..\..\server\TracyMmap.cpp" />
<ClCompile Include="..\..\..\server\TracyMouse.cpp" />
<ClCompile Include="..\..\..\server\TracyPrint.cpp" />
<ClCompile Include="..\..\..\server\TracySourceView.cpp" />
<ClCompile Include="..\..\..\server\TracyStorage.cpp" />
@ -200,6 +201,7 @@
<ClInclude Include="..\..\..\server\TracyMemory.hpp" />
<ClInclude Include="..\..\..\server\TracyMicroArchitecture.hpp" />
<ClInclude Include="..\..\..\server\TracyMmap.hpp" />
<ClInclude Include="..\..\..\server\TracyMouse.hpp" />
<ClInclude Include="..\..\..\server\TracyPopcnt.hpp" />
<ClInclude Include="..\..\..\server\TracyPrint.hpp" />
<ClInclude Include="..\..\..\server\TracyShortPtr.hpp" />

View File

@ -201,6 +201,9 @@
<ClCompile Include="..\..\..\server\TracyMicroArchitecture.cpp">
<Filter>server</Filter>
</ClCompile>
<ClCompile Include="..\..\..\server\TracyMouse.cpp">
<Filter>server</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\common\tracy_lz4.hpp">
@ -491,6 +494,9 @@
<ClInclude Include="..\..\..\server\TracyMicroArchitecture.hpp">
<Filter>server</Filter>
</ClInclude>
<ClInclude Include="..\..\..\server\TracyMouse.hpp">
<Filter>server</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Natvis Include="DebugVis.natvis" />

26
server/TracyMouse.cpp Normal file
View File

@ -0,0 +1,26 @@
#include "TracyMouse.hpp"
namespace tracy
{
bool IsMouseDown( ImGuiMouseButton button )
{
return ImGui::IsMouseDown( button );
}
bool IsMouseClicked( ImGuiMouseButton button )
{
return ImGui::IsMouseClicked( button );
}
bool IsMouseDragging( ImGuiMouseButton button, float lock_threshold )
{
return ImGui::IsMouseDragging( button, lock_threshold );
}
ImVec2 GetMouseDragDelta( ImGuiMouseButton button, float lock_threshold )
{
return ImGui::GetMouseDragDelta( button, lock_threshold );
}
}

16
server/TracyMouse.hpp Normal file
View File

@ -0,0 +1,16 @@
#ifndef __TRACYMOUSE_HPP__
#define __TRACYMOUSE_HPP__
#include "../imgui/imgui.h"
namespace tracy
{
bool IsMouseDown( ImGuiMouseButton button );
bool IsMouseClicked( ImGuiMouseButton button );
bool IsMouseDragging( ImGuiMouseButton button, float lock_threshold = -1.f );
ImVec2 GetMouseDragDelta( ImGuiMouseButton button, float lock_threshold = -1.f );
}
#endif