Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
ofxImGui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wt
ofxImGui
Commits
7a8e1c40
Commit
7a8e1c40
authored
Dec 03, 2019
by
w4t
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AddValues can now use DragXXX components if no range is provided
parent
b815013f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
18 deletions
+86
-18
imHelpers.cpp
src/imHelpers.cpp
+72
-9
imHelpers.h
src/imHelpers.h
+14
-9
No files found.
src/imHelpers.cpp
View file @
7a8e1c40
...
...
@@ -641,7 +641,14 @@ bool ofxImGui::AddValues(const std::string& name, std::vector<glm::tvec2<int>>&
for
(
size_t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
const
auto
iname
=
name
+
" "
+
ofToString
(
i
);
result
|=
ImGui
::
SliderInt2
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]),
minValue
,
maxValue
);
if
(
minValue
==
0
&&
maxValue
==
0
)
{
result
|=
ImGui
::
DragInt2
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]));
}
else
{
result
|=
ImGui
::
SliderInt2
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]),
minValue
,
maxValue
);
}
}
return
result
;
}
...
...
@@ -653,7 +660,14 @@ bool ofxImGui::AddValues(const std::string& name, std::vector<glm::tvec3<int>>&
for
(
size_t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
const
auto
iname
=
name
+
" "
+
ofToString
(
i
);
result
|=
ImGui
::
SliderInt3
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]),
minValue
,
maxValue
);
if
(
minValue
==
0
&&
maxValue
==
0
)
{
result
|=
ImGui
::
DragInt3
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]));
}
else
{
result
|=
ImGui
::
SliderInt3
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]),
minValue
,
maxValue
);
}
}
return
result
;
}
...
...
@@ -665,7 +679,14 @@ bool ofxImGui::AddValues(const std::string& name, std::vector<glm::tvec4<int>>&
for
(
size_t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
const
auto
iname
=
name
+
" "
+
ofToString
(
i
);
result
|=
ImGui
::
SliderInt4
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]),
minValue
,
maxValue
);
if
(
minValue
==
0
&&
maxValue
==
0
)
{
result
|=
ImGui
::
DragInt4
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]));
}
else
{
result
|=
ImGui
::
SliderInt4
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]),
minValue
,
maxValue
);
}
}
return
result
;
}
...
...
@@ -677,7 +698,14 @@ bool ofxImGui::AddValues(const std::string& name, std::vector<glm::vec2>& values
for
(
size_t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
const
auto
iname
=
name
+
" "
+
ofToString
(
i
);
result
|=
ImGui
::
SliderFloat2
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]),
minValue
,
maxValue
);
if
(
minValue
==
0
&&
maxValue
==
0
)
{
result
|=
ImGui
::
DragFloat2
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]));
}
else
{
result
|=
ImGui
::
SliderFloat2
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]),
minValue
,
maxValue
);
}
}
return
result
;
}
...
...
@@ -689,7 +717,14 @@ bool ofxImGui::AddValues(const std::string& name, std::vector<glm::vec3>& values
for
(
size_t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
const
auto
iname
=
name
+
" "
+
ofToString
(
i
);
result
|=
ImGui
::
SliderFloat3
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]),
minValue
,
maxValue
);
if
(
minValue
==
0
&&
maxValue
==
0
)
{
result
|=
ImGui
::
DragFloat3
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]));
}
else
{
result
|=
ImGui
::
SliderFloat3
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]),
minValue
,
maxValue
);
}
}
return
result
;
}
...
...
@@ -701,7 +736,14 @@ bool ofxImGui::AddValues(const std::string& name, std::vector<glm::vec4>& values
for
(
size_t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
const
auto
iname
=
name
+
" "
+
ofToString
(
i
);
result
|=
ImGui
::
SliderFloat4
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]),
minValue
,
maxValue
);
if
(
minValue
==
0
&&
maxValue
==
0
)
{
result
|=
ImGui
::
DragFloat4
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]));
}
else
{
result
|=
ImGui
::
SliderFloat4
(
GetUniqueName
(
iname
),
glm
::
value_ptr
(
values
[
i
]),
minValue
,
maxValue
);
}
}
return
result
;
}
...
...
@@ -715,7 +757,14 @@ bool ofxImGui::AddValues(const std::string& name, std::vector<ofVec2f>& values,
for
(
size_t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
const
auto
iname
=
name
+
" "
+
ofToString
(
i
);
result
|=
ImGui
::
SliderFloat2
(
GetUniqueName
(
iname
),
values
[
i
].
getPtr
(),
minValue
,
maxValue
);
if
(
minValue
==
0
&&
maxValue
==
0
)
{
result
|=
ImGui
::
DragFloat2
(
GetUniqueName
(
iname
),
values
[
i
].
getPtr
());
}
else
{
result
|=
ImGui
::
SliderFloat2
(
GetUniqueName
(
iname
),
values
[
i
].
getPtr
(),
minValue
,
maxValue
);
}
}
return
result
;
}
...
...
@@ -727,7 +776,14 @@ bool ofxImGui::AddValues(const std::string& name, std::vector<ofVec3f>& values,
for
(
size_t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
const
auto
iname
=
name
+
" "
+
ofToString
(
i
);
result
|=
ImGui
::
SliderFloat3
(
GetUniqueName
(
iname
),
values
[
i
].
getPtr
(),
minValue
,
maxValue
);
if
(
minValue
==
0
&&
maxValue
==
0
)
{
result
|=
ImGui
::
DragFloat3
(
GetUniqueName
(
iname
),
values
[
i
].
getPtr
());
}
else
{
result
|=
ImGui
::
SliderFloat3
(
GetUniqueName
(
iname
),
values
[
i
].
getPtr
(),
minValue
,
maxValue
);
}
}
return
result
;
}
...
...
@@ -739,7 +795,14 @@ bool ofxImGui::AddValues(const std::string& name, std::vector<ofVec4f>& values,
for
(
size_t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
const
auto
iname
=
name
+
" "
+
ofToString
(
i
);
result
|=
ImGui
::
SliderFloat4
(
GetUniqueName
(
iname
),
values
[
i
].
getPtr
(),
minValue
,
maxValue
);
if
(
minValue
==
0
&&
maxValue
==
0
)
{
result
|=
ImGui
::
DragFloat4
(
GetUniqueName
(
iname
),
values
[
i
].
getPtr
());
}
else
{
result
|=
ImGui
::
SliderFloat4
(
GetUniqueName
(
iname
),
values
[
i
].
getPtr
(),
minValue
,
maxValue
);
}
}
return
result
;
}
...
...
src/imHelpers.h
View file @
7a8e1c40
...
...
@@ -72,6 +72,11 @@ namespace ImGui {
IMGUI_API
void
TextWrapped
(
std
::
string
const
&
text
);
IMGUI_API
void
LabelText
(
const
char
*
label
,
std
::
string
const
&
text
);
IMGUI_API
void
BulletText
(
std
::
string
const
&
text
);
IMGUI_API
void
Image
(
const
ofBaseHasTexture
&
image
,
const
ImVec2
&
size
,
const
ImVec2
&
uv0
=
ImVec2
(
0
,
0
),
const
ImVec2
&
uv1
=
ImVec2
(
1
,
1
),
const
ImVec4
&
tint_col
=
ImVec4
(
1
,
1
,
1
,
1
),
const
ImVec4
&
border_col
=
ImVec4
(
0
,
0
,
0
,
0
));
IMGUI_API
bool
ImageButton
(
const
ofBaseHasTexture
&
image
,
const
ImVec2
&
size
,
const
ImVec2
&
uv0
=
ImVec2
(
0
,
0
),
const
ImVec2
&
uv1
=
ImVec2
(
1
,
1
),
int
frame_padding
=
-
1
,
const
ImVec4
&
bg_col
=
ImVec4
(
0
,
0
,
0
,
0
),
const
ImVec4
&
tint_col
=
ImVec4
(
1
,
1
,
1
,
1
));
// <0 frame_padding uses default frame padding settings. 0 for no padding
IMGUI_API
void
Image
(
const
ofTexture
&
texture
,
const
ImVec2
&
size
,
const
ImVec2
&
uv0
=
ImVec2
(
0
,
0
),
const
ImVec2
&
uv1
=
ImVec2
(
1
,
1
),
const
ImVec4
&
tint_col
=
ImVec4
(
1
,
1
,
1
,
1
),
const
ImVec4
&
border_col
=
ImVec4
(
0
,
0
,
0
,
0
));
IMGUI_API
bool
ImageButton
(
const
ofTexture
&
texture
,
const
ImVec2
&
size
,
const
ImVec2
&
uv0
=
ImVec2
(
0
,
0
),
const
ImVec2
&
uv1
=
ImVec2
(
1
,
1
),
int
frame_padding
=
-
1
,
const
ImVec4
&
bg_col
=
ImVec4
(
0
,
0
,
0
,
0
),
const
ImVec4
&
tint_col
=
ImVec4
(
1
,
1
,
1
,
1
));
// <0 frame_padding uses default frame padding settings. 0 for no padding
}
namespace
ofxImGui
...
...
@@ -157,18 +162,18 @@ namespace ofxImGui
#endif
#if OF_VERSION_MINOR >= 10
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
glm
::
ivec2
>&
values
,
int
minValue
,
int
maxValue
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
glm
::
ivec3
>&
values
,
int
minValue
,
int
maxValue
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
glm
::
ivec4
>&
values
,
int
minValue
,
int
maxValue
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
glm
::
ivec2
>&
values
,
int
minValue
=
0
,
int
maxValue
=
0
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
glm
::
ivec3
>&
values
,
int
minValue
=
0
,
int
maxValue
=
0
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
glm
::
ivec4
>&
values
,
int
minValue
=
0
,
int
maxValue
=
0
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
glm
::
vec2
>&
values
,
float
minValue
,
float
maxValue
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
glm
::
vec3
>&
values
,
float
minValue
,
float
maxValue
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
glm
::
vec4
>&
values
,
float
minValue
,
float
maxValue
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
glm
::
vec2
>&
values
,
float
minValue
=
0
,
float
maxValue
=
0
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
glm
::
vec3
>&
values
,
float
minValue
=
0
,
float
maxValue
=
0
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
glm
::
vec4
>&
values
,
float
minValue
=
0
,
float
maxValue
=
0
);
#endif
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
ofVec2f
>&
values
,
float
minValue
,
float
maxValue
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
ofVec3f
>&
values
,
float
minValue
,
float
maxValue
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
ofVec4f
>&
values
,
float
minValue
,
float
maxValue
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
ofVec2f
>&
values
,
float
minValue
=
0
,
float
maxValue
=
0
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
ofVec3f
>&
values
,
float
minValue
=
0
,
float
maxValue
=
0
);
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
ofVec4f
>&
values
,
float
minValue
=
0
,
float
maxValue
=
0
);
template
<
typename
DataType
>
bool
AddValues
(
const
std
::
string
&
name
,
std
::
vector
<
DataType
>&
values
,
DataType
minValue
,
DataType
maxValue
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment