libigl v2.5.0
Loading...
Searching...
No Matches
ImGuiTraits.h
Go to the documentation of this file.
1// This file is part of libigl, a simple c++ geometry processing library.
2//
3// Copyright (C) 2018 Jérémie Dumas <jeremie.dumas@ens-lyon.org>
4//
5// This Source Code Form is subject to the terms of the Mozilla Public License
6// v. 2.0. If a copy of the MPL was not distributed with this file, You can
7// obtain one at http://mozilla.org/MPL/2.0/.
8#ifndef IGL_OPENGL_GLFW_IMGUI_IMGUITRAITS_H
9#define IGL_OPENGL_GLFW_IMGUI_IMGUITRAITS_H
10
11#include <imgui.h>
12
13// Extend ImGui by populating its namespace directly
14namespace ImGui
15{
16
17// Infer ImGuiDataType enum based on actual type
18template<typename T>
20{
21 static const ImGuiDataType value; // link error
22 static const char * format;
23};
24
25template<>
27{
28 static constexpr ImGuiDataType value = ImGuiDataType_S32;
29 static constexpr const char *format = "%d";
30};
31
32template<>
33class ImGuiDataTypeTraits<unsigned int>
34{
35 static constexpr ImGuiDataType value = ImGuiDataType_U32;
36 static constexpr const char *format = "%u";
37};
38
39template<>
40class ImGuiDataTypeTraits<long long>
41{
42 static constexpr ImGuiDataType value = ImGuiDataType_S64;
43 static constexpr const char *format = "%lld";
44};
45
46template<>
47class ImGuiDataTypeTraits<unsigned long long>
48{
49 static constexpr ImGuiDataType value = ImGuiDataType_U64;
50 static constexpr const char *format = "%llu";
51};
52
53template<>
55{
56 static constexpr ImGuiDataType value = ImGuiDataType_Float;
57 static constexpr const char *format = "%.3f";
58};
59
60template<>
62{
63 static constexpr ImGuiDataType value = ImGuiDataType_Double;
64 static constexpr const char *format = "%.6f";
65};
66
67} // namespace ImGui
68
69#endif // IGL_OPENGL_GLFW_IMGUI_IMGUIHELPERS_H
Definition ImGuiTraits.h:20
Definition ImGuiHelpers.h:26