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
2f2a2663
Commit
2f2a2663
authored
Dec 01, 2019
by
w4t
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enables Combo with vector<string>
parent
2f79f688
Pipeline
#61
canceled with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
imHelpers.cpp
src/imHelpers.cpp
+17
-0
imHelpers.h
src/imHelpers.h
+3
-2
No files found.
src/imHelpers.cpp
View file @
2f2a2663
...
...
@@ -756,3 +756,20 @@ void ofxImGui::AddImage(ofTexture& texture, const ofVec2f& size)
ImTextureID
textureID
=
(
ImTextureID
)(
uintptr_t
)
texture
.
texData
.
textureID
;
ImGui
::
Image
(
textureID
,
size
);
}
//--------------------------------------------------------------
static
auto
vector_getter
=
[](
void
*
vec
,
int
idx
,
const
char
**
out_text
)
{
auto
&
vector
=
*
static_cast
<
std
::
vector
<
std
::
string
>*>
(
vec
);
if
(
idx
<
0
||
idx
>=
static_cast
<
int
>
(
vector
.
size
()))
{
return
false
;
}
*
out_text
=
vector
.
at
(
idx
).
c_str
();
return
true
;
};
//--------------------------------------------------------------
bool
ofxImGui
::
VectorCombo
(
const
char
*
label
,
int
*
currIndex
,
std
::
vector
<
std
::
string
>&
values
)
{
if
(
values
.
empty
())
{
return
false
;
}
return
ImGui
::
Combo
(
label
,
currIndex
,
vector_getter
,
static_cast
<
void
*>
(
&
values
),
values
.
size
());
}
\ No newline at end of file
src/imHelpers.h
View file @
2f2a2663
#pragma once
//
#include "ofGLBaseTypes.h"
#include "ofGLBaseTypes.h"
#include "ofParameter.h"
#include "ofRectangle.h"
#include "ofTexture.h"
//#include "ofGLBaseTypes.h"
#include "ofBaseTypes.h"
#include "imgui.h"
...
...
@@ -12,6 +11,8 @@ static const int kImGuiMargin = 10;
namespace
ofxImGui
{
bool
VectorCombo
(
const
char
*
label
,
int
*
currIndex
,
std
::
vector
<
std
::
string
>&
values
);
struct
WindowOpen
{
std
::
stack
<
std
::
vector
<
std
::
string
>>
usedNames
;
...
...
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