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
14
namespace
ImGui
15
{
16
17
// Infer ImGuiDataType enum based on actual type
18
template
<
typename
T>
19
class
ImGuiDataTypeTraits
20
{
21
static
const
ImGuiDataType value;
// link error
22
static
const
char
* format;
23
};
24
25
template
<>
26
class
ImGuiDataTypeTraits
<int>
27
{
28
static
constexpr
ImGuiDataType value = ImGuiDataType_S32;
29
static
constexpr
const
char
*format =
"%d"
;
30
};
31
32
template
<>
33
class
ImGuiDataTypeTraits
<unsigned int>
34
{
35
static
constexpr
ImGuiDataType value = ImGuiDataType_U32;
36
static
constexpr
const
char
*format =
"%u"
;
37
};
38
39
template
<>
40
class
ImGuiDataTypeTraits
<long long>
41
{
42
static
constexpr
ImGuiDataType value = ImGuiDataType_S64;
43
static
constexpr
const
char
*format =
"%lld"
;
44
};
45
46
template
<>
47
class
ImGuiDataTypeTraits
<unsigned long long>
48
{
49
static
constexpr
ImGuiDataType value = ImGuiDataType_U64;
50
static
constexpr
const
char
*format =
"%llu"
;
51
};
52
53
template
<>
54
class
ImGuiDataTypeTraits
<float>
55
{
56
static
constexpr
ImGuiDataType value = ImGuiDataType_Float;
57
static
constexpr
const
char
*format =
"%.3f"
;
58
};
59
60
template
<>
61
class
ImGuiDataTypeTraits
<double>
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
ImGui::ImGuiDataTypeTraits
Definition
ImGuiTraits.h:20
ImGui
Definition
ImGuiHelpers.h:26
include
igl
opengl
glfw
imgui
ImGuiTraits.h
Generated by
1.9.8