Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
hw3d
Commits
6df339c9
Commit
6df339c9
authored
May 05, 2019
by
chili
Browse files
better organization of imgui windows
parent
83418ac3
Changes
2
Show whitespace changes
Inline
Side-by-side
hw3d/App.cpp
View file @
6df339c9
...
...
@@ -92,6 +92,7 @@ void App::DoFrame()
wnd
.
Gfx
().
SetCamera
(
cam
.
GetMatrix
()
);
light
.
Bind
(
wnd
.
Gfx
(),
cam
.
GetMatrix
()
);
// render geometry
for
(
auto
&
d
:
drawables
)
{
d
->
Update
(
wnd
.
kbd
.
KeyIsPressed
(
VK_SPACE
)
?
0.0
f
:
dt
);
...
...
@@ -99,7 +100,19 @@ void App::DoFrame()
}
light
.
Draw
(
wnd
.
Gfx
()
);
// imgui window to control simulation speed
// imgui windows
SpawnSimulationWindow
();
cam
.
SpawnControlWindow
();
light
.
SpawnControlWindow
();
SpawnBoxWindowManagerWindow
();
SpawnBoxWindows
();
// present
wnd
.
Gfx
().
EndFrame
();
}
void
App
::
SpawnSimulationWindow
()
noexcept
{
if
(
ImGui
::
Begin
(
"Simulation Speed"
)
)
{
ImGui
::
SliderFloat
(
"Speed Factor"
,
&
speed_factor
,
0.0
f
,
6.0
f
,
"%.4f"
,
3.2
f
);
...
...
@@ -107,10 +120,10 @@ void App::DoFrame()
ImGui
::
Text
(
"Status: %s"
,
wnd
.
kbd
.
KeyIsPressed
(
VK_SPACE
)
?
"PAUSED"
:
"RUNNING (hold spacebar to pause)"
);
}
ImGui
::
End
();
// imgui windows to control camera and light
cam
.
SpawnControlWindow
();
light
.
SpawnControlWindow
();
// imgui window to open box windows
}
void
App
::
SpawnBoxWindowManagerWindow
()
noexcept
{
if
(
ImGui
::
Begin
(
"Boxes"
)
)
{
using
namespace
std
::
string_literals
;
...
...
@@ -138,14 +151,14 @@ void App::DoFrame()
}
}
ImGui
::
End
();
// imgui box attribute control windows
}
void
App
::
SpawnBoxWindows
()
noexcept
{
for
(
auto
id
:
boxControlIds
)
{
boxes
[
id
]
->
SpawnControlWindow
(
id
,
wnd
.
Gfx
()
);
}
// present
wnd
.
Gfx
().
EndFrame
();
}
App
::~
App
()
...
...
hw3d/App.h
View file @
6df339c9
...
...
@@ -15,6 +15,9 @@ public:
~
App
();
private:
void
DoFrame
();
void
SpawnSimulationWindow
()
noexcept
;
void
SpawnBoxWindowManagerWindow
()
noexcept
;
void
SpawnBoxWindows
()
noexcept
;
private:
ImguiManager
imgui
;
Window
wnd
;
...
...
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