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
4625ad11
Commit
4625ad11
authored
Dec 01, 2019
by
w4t
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove engine pointer
parent
7ceec1d4
Pipeline
#70
canceled with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
48 deletions
+27
-48
EngineGLFW.cpp
src/EngineGLFW.cpp
+2
-1
Gui.cpp
src/Gui.cpp
+9
-45
Gui.h
src/Gui.h
+16
-2
No files found.
src/EngineGLFW.cpp
View file @
4625ad11
...
@@ -549,7 +549,8 @@ namespace ofxImGui
...
@@ -549,7 +549,8 @@ namespace ofxImGui
if
(
g_FontTexture
)
if
(
g_FontTexture
)
{
{
glDeleteTextures
(
1
,
&
g_FontTexture
);
glDeleteTextures
(
1
,
&
g_FontTexture
);
ImGui
::
GetIO
().
Fonts
->
TexID
=
0
;
//JVC: This is causing an error
//ImGui::GetIO().Fonts->TexID = 0;
g_FontTexture
=
0
;
g_FontTexture
=
0
;
}
}
}
}
...
...
src/Gui.cpp
View file @
4625ad11
#include "Gui.h"
#include "Gui.h"
#include "ofAppRunner.h"
#include "ofAppRunner.h"
#if defined(TARGET_OPENGLES)
#include "EngineOpenGLES.h"
#elif defined (OF_TARGET_API_VULKAN)
#include "EngineVk.h"
#else
#include "EngineGLFW.h"
#endif
// @RemoteImgui begin
// @RemoteImgui begin
#include "imgui_remote.h"
#include "imgui_remote.h"
// @RemoteImgui end
// @RemoteImgui end
...
@@ -18,7 +10,6 @@ namespace ofxImGui
...
@@ -18,7 +10,6 @@ namespace ofxImGui
//--------------------------------------------------------------
//--------------------------------------------------------------
Gui
::
Gui
()
Gui
::
Gui
()
:
lastTime
(
0.0
f
)
:
lastTime
(
0.0
f
)
,
engine
(
nullptr
)
,
theme
(
nullptr
)
,
theme
(
nullptr
)
{
{
ImGui
::
CreateContext
();
ImGui
::
CreateContext
();
...
@@ -39,23 +30,8 @@ namespace ofxImGui
...
@@ -39,23 +30,8 @@ namespace ofxImGui
io
.
DisplaySize
=
ImVec2
((
float
)
ofGetWidth
(),
(
float
)
ofGetHeight
());
io
.
DisplaySize
=
ImVec2
((
float
)
ofGetWidth
(),
(
float
)
ofGetHeight
());
io
.
MouseDrawCursor
=
false
;
io
.
MouseDrawCursor
=
false
;
if
(
engine
)
{
delete
engine
;
engine
=
nullptr
;
}
#if defined(TARGET_OPENGLES)
engine
=
new
EngineOpenGLES
();
#elif defined (OF_TARGET_API_VULKAN)
engine
=
new
EngineVk
();
#elif FORCE_APPGLUT
engine
=
new
EngineGLUT
();
#else
engine
=
new
EngineGLFW
();
#endif
autoDraw
=
autoDraw_
;
autoDraw
=
autoDraw_
;
engine
->
setup
(
autoDraw
);
engine
.
setup
(
autoDraw
);
if
(
theme_
)
if
(
theme_
)
{
{
...
@@ -73,16 +49,7 @@ namespace ofxImGui
...
@@ -73,16 +49,7 @@ namespace ofxImGui
//--------------------------------------------------------------
//--------------------------------------------------------------
void
Gui
::
exit
()
void
Gui
::
exit
()
{
{
if
(
engine
)
{
delete
engine
;
engine
=
nullptr
;
}
//if(io)
//{
// io->Fonts->TexID = 0;
// io = nullptr;
//}
if
(
theme
)
if
(
theme
)
{
{
delete
theme
;
delete
theme
;
...
@@ -90,7 +57,11 @@ namespace ofxImGui
...
@@ -90,7 +57,11 @@ namespace ofxImGui
}
}
for
(
size_t
i
=
0
;
i
<
loadedTextures
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
loadedTextures
.
size
();
i
++
)
{
{
if
(
loadedTextures
[
i
])
{
delete
loadedTextures
[
i
];
delete
loadedTextures
[
i
];
loadedTextures
[
i
]
=
NULL
;
}
}
}
loadedTextures
.
clear
();
loadedTextures
.
clear
();
...
@@ -159,12 +130,11 @@ namespace ofxImGui
...
@@ -159,12 +130,11 @@ namespace ofxImGui
//--------------------------------------------------------------
//--------------------------------------------------------------
GLuint
Gui
::
loadPixels
(
ofPixels
&
pixels
)
{
GLuint
Gui
::
loadPixels
(
ofPixels
&
pixels
)
{
return
engine
->
loadTextureImage2D
(
pixels
.
getData
(),
(
int
)
pixels
.
getWidth
(),
(
int
)
pixels
.
getHeight
());
return
engine
.
loadTextureImage2D
(
pixels
.
getData
(),
(
int
)
pixels
.
getWidth
(),
(
int
)
pixels
.
getHeight
());
}
}
//--------------------------------------------------------------
//--------------------------------------------------------------
GLuint
Gui
::
loadPixels
(
const
std
::
string
&
imagePath
)
{
GLuint
Gui
::
loadPixels
(
const
std
::
string
&
imagePath
)
{
if
(
!
engine
)
return
-
1
;
ofPixels
pixels
;
ofPixels
pixels
;
ofLoadImage
(
pixels
,
imagePath
);
ofLoadImage
(
pixels
,
imagePath
);
return
loadPixels
(
pixels
);
return
loadPixels
(
pixels
);
...
@@ -172,7 +142,6 @@ namespace ofxImGui
...
@@ -172,7 +142,6 @@ namespace ofxImGui
//--------------------------------------------------------------
//--------------------------------------------------------------
GLuint
Gui
::
loadImage
(
ofImage
&
image
)
{
GLuint
Gui
::
loadImage
(
ofImage
&
image
)
{
if
(
!
engine
)
return
-
1
;
return
loadPixels
(
image
.
getPixels
());
return
loadPixels
(
image
.
getPixels
());
}
}
...
@@ -206,11 +175,6 @@ namespace ofxImGui
...
@@ -206,11 +175,6 @@ namespace ofxImGui
//--------------------------------------------------------------
//--------------------------------------------------------------
void
Gui
::
begin
()
{
void
Gui
::
begin
()
{
if
(
!
engine
)
{
ofLogError
(
__FUNCTION__
)
<<
"setup() call required, calling it for you"
;
setup
();
}
ImGuiIO
&
io
=
ImGui
::
GetIO
();
ImGuiIO
&
io
=
ImGui
::
GetIO
();
float
currentTime
=
ofGetElapsedTimef
();
float
currentTime
=
ofGetElapsedTimef
();
...
@@ -226,7 +190,7 @@ namespace ofxImGui
...
@@ -226,7 +190,7 @@ namespace ofxImGui
// Update settings
// Update settings
io
.
MousePos
=
ImVec2
((
float
)
ofGetMouseX
(),
(
float
)
ofGetMouseY
());
io
.
MousePos
=
ImVec2
((
float
)
ofGetMouseX
(),
(
float
)
ofGetMouseY
());
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
io
.
MouseDown
[
i
]
=
engine
->
mousePressed
[
i
];
io
.
MouseDown
[
i
]
=
engine
.
mousePressed
[
i
];
}
}
ImGui
::
RemoteUpdate
();
ImGui
::
RemoteUpdate
();
...
@@ -244,7 +208,7 @@ namespace ofxImGui
...
@@ -244,7 +208,7 @@ namespace ofxImGui
{
{
if
(
!
autoDraw
)
if
(
!
autoDraw
)
{
{
engine
->
draw
();
engine
.
draw
();
}
}
}
}
}
}
src/Gui.h
View file @
4625ad11
...
@@ -3,7 +3,15 @@
...
@@ -3,7 +3,15 @@
#include "ofImage.h"
#include "ofImage.h"
#include "ofPixels.h"
#include "ofPixels.h"
#include "ofTexture.h"
#include "ofTexture.h"
#include "BaseEngine.h"
#if defined(TARGET_OPENGLES)
#include "EngineOpenGLES.h"
#elif defined (OF_TARGET_API_VULKAN)
#include "EngineVk.h"
#else
#include "EngineGLFW.h"
#endif
#include "BaseTheme.h"
#include "BaseTheme.h"
namespace
ofxImGui
namespace
ofxImGui
...
@@ -42,7 +50,13 @@ namespace ofxImGui
...
@@ -42,7 +50,13 @@ namespace ofxImGui
GLuint
loadTexture
(
ofTexture
&
texture
,
const
std
::
string
&
imagePath
);
GLuint
loadTexture
(
ofTexture
&
texture
,
const
std
::
string
&
imagePath
);
private:
private:
BaseEngine
*
engine
;
#if defined(TARGET_OPENGLES)
EngineOpenGLES
engine
;
#elif defined (OF_TARGET_API_VULKAN)
EngineVk
engine
;
#else
EngineGLFW
engine
;
#endif
float
lastTime
;
float
lastTime
;
bool
autoDraw
;
bool
autoDraw
;
...
...
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