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
773570e5
Commit
773570e5
authored
Dec 07, 2019
by
w4t
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Multiwindow hold each instance's context and switch them and example
parent
bd655e50
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
4 deletions
+54
-4
addons.make
example-multiwindow/addons.make
+2
-0
main.cpp
example-multiwindow/src/main.cpp
+22
-0
ofApp.cpp
example-multiwindow/src/ofApp.cpp
+1
-0
ofApp.h
example-multiwindow/src/ofApp.h
+23
-0
Gui.cpp
src/Gui.cpp
+5
-4
Gui.h
src/Gui.h
+1
-0
No files found.
example-multiwindow/addons.make
0 → 100644
View file @
773570e5
ofxImGui
ofxXmlSettings
\ No newline at end of file
example-multiwindow/src/main.cpp
0 → 100644
View file @
773570e5
#include "ofMain.h"
#include "ofApp.h"
#include "ofAppGLFWWindow.h"
//========================================================================
int
main
(
){
ofGLFWWindowSettings
settings
;
settings
.
setSize
(
300
,
300
);
settings
.
setPosition
(
ofVec2f
(
0
,
100
));
auto
window1
=
ofCreateWindow
(
settings
);
settings
.
setPosition
(
ofVec2f
(
300
,
100
));
auto
window2
=
ofCreateWindow
(
settings
);
auto
app1
=
std
::
make_shared
<
ofApp
>
();
auto
app2
=
std
::
make_shared
<
ofApp
>
();
ofRunApp
(
window1
,
app1
);
ofRunApp
(
window2
,
app2
);
ofRunMainLoop
();
}
example-multiwindow/src/ofApp.cpp
0 → 100644
View file @
773570e5
#include "ofApp.h"
\ No newline at end of file
example-multiwindow/src/ofApp.h
0 → 100644
View file @
773570e5
#pragma once
#include "ofMain.h"
#include "ofxImGui.h"
class
ofApp
:
public
ofBaseApp
{
public:
ofApp
()
:
v
(
0
)
{}
void
setup
()
{
gui
.
setup
();
}
void
draw
()
{
gui
.
begin
();
ImGui
::
SliderFloat
(
"slider"
,
&
v
,
0
.
f
,
10
.
f
);
gui
.
end
();
}
private:
ofxImGui
::
Gui
gui
;
float
v
;
};
src/Gui.cpp
View file @
773570e5
...
...
@@ -12,19 +12,19 @@ namespace ofxImGui
:
lastTime
(
0.0
f
)
,
theme
(
nullptr
)
{
ImGui
::
CreateContext
();
context
=
ImGui
::
CreateContext
();
}
//--------------------------------------------------------------
Gui
::~
Gui
()
{
exit
();
ImGui
::
DestroyContext
();
ImGui
::
DestroyContext
(
context
);
}
//--------------------------------------------------------------
void
Gui
::
setup
(
BaseTheme
*
theme_
,
bool
autoDraw_
)
{
ImGui
::
CreateContext
(
);
ImGui
::
SetCurrentContext
(
context
);
ImGuiIO
&
io
=
ImGui
::
GetIO
();
io
.
DisplaySize
=
ImVec2
((
float
)
ofGetWidth
(),
(
float
)
ofGetHeight
());
...
...
@@ -66,7 +66,7 @@ namespace ofxImGui
}
loadedTextures
.
clear
();
ImGui
::
DestroyContext
();
ImGui
::
DestroyContext
(
context
);
}
//--------------------------------------------------------------
...
...
@@ -165,6 +165,7 @@ namespace ofxImGui
//--------------------------------------------------------------
void
Gui
::
begin
()
{
ImGui
::
SetCurrentContext
(
context
);
ImGuiIO
&
io
=
ImGui
::
GetIO
();
float
currentTime
=
ofGetElapsedTimef
();
...
...
src/Gui.h
View file @
773570e5
...
...
@@ -63,5 +63,6 @@ namespace ofxImGui
BaseTheme
*
theme
;
std
::
vector
<
ofTexture
*>
loadedTextures
;
ImGuiContext
*
context
;
};
}
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