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
if
(
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
;
}
}
...
...
src/Gui.cpp
View file @
4625ad11
#include "Gui.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
#include "imgui_remote.h"
// @RemoteImgui end
...
...
@@ -18,7 +10,6 @@ namespace ofxImGui
//--------------------------------------------------------------
Gui
::
Gui
()
:
lastTime
(
0.0
f
)
,
engine
(
nullptr
)
,
theme
(
nullptr
)
{
ImGui
::
CreateContext
();
...
...
@@ -39,23 +30,8 @@ namespace ofxImGui
io
.
DisplaySize
=
ImVec2
((
float
)
ofGetWidth
(),
(
float
)
ofGetHeight
());
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_
;
engine
->
setup
(
autoDraw
);
engine
.
setup
(
autoDraw
);
if
(
theme_
)
{
...
...
@@ -73,16 +49,7 @@ namespace ofxImGui
//--------------------------------------------------------------
void
Gui
::
exit
()
{
if
(
engine
)
{
delete
engine
;
engine
=
nullptr
;
}
//if(io)
//{
// io->Fonts->TexID = 0;
// io = nullptr;
//}
if
(
theme
)
{
delete
theme
;
...
...
@@ -90,7 +57,11 @@ namespace ofxImGui
}
for
(
size_t
i
=
0
;
i
<
loadedTextures
.
size
();
i
++
)
{
if
(
loadedTextures
[
i
])
{
delete
loadedTextures
[
i
];
loadedTextures
[
i
]
=
NULL
;
}
}
loadedTextures
.
clear
();
...
...
@@ -159,12 +130,11 @@ namespace ofxImGui
//--------------------------------------------------------------
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
)
{
if
(
!
engine
)
return
-
1
;
ofPixels
pixels
;
ofLoadImage
(
pixels
,
imagePath
);
return
loadPixels
(
pixels
);
...
...
@@ -172,7 +142,6 @@ namespace ofxImGui
//--------------------------------------------------------------
GLuint
Gui
::
loadImage
(
ofImage
&
image
)
{
if
(
!
engine
)
return
-
1
;
return
loadPixels
(
image
.
getPixels
());
}
...
...
@@ -206,11 +175,6 @@ namespace ofxImGui
//--------------------------------------------------------------
void
Gui
::
begin
()
{
if
(
!
engine
)
{
ofLogError
(
__FUNCTION__
)
<<
"setup() call required, calling it for you"
;
setup
();
}
ImGuiIO
&
io
=
ImGui
::
GetIO
();
float
currentTime
=
ofGetElapsedTimef
();
...
...
@@ -226,7 +190,7 @@ namespace ofxImGui
// Update settings
io
.
MousePos
=
ImVec2
((
float
)
ofGetMouseX
(),
(
float
)
ofGetMouseY
());
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
io
.
MouseDown
[
i
]
=
engine
->
mousePressed
[
i
];
io
.
MouseDown
[
i
]
=
engine
.
mousePressed
[
i
];
}
ImGui
::
RemoteUpdate
();
...
...
@@ -244,7 +208,7 @@ namespace ofxImGui
{
if
(
!
autoDraw
)
{
engine
->
draw
();
engine
.
draw
();
}
}
}
src/Gui.h
View file @
4625ad11
...
...
@@ -3,7 +3,15 @@
#include "ofImage.h"
#include "ofPixels.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"
namespace
ofxImGui
...
...
@@ -42,7 +50,13 @@ namespace ofxImGui
GLuint
loadTexture
(
ofTexture
&
texture
,
const
std
::
string
&
imagePath
);
private:
BaseEngine
*
engine
;
#if defined(TARGET_OPENGLES)
EngineOpenGLES
engine
;
#elif defined (OF_TARGET_API_VULKAN)
EngineVk
engine
;
#else
EngineGLFW
engine
;
#endif
float
lastTime
;
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