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
9927aeba
Commit
9927aeba
authored
May 03, 2019
by
chili
Browse files
select boxes to manipulate
parent
8e18159c
Changes
2
Show whitespace changes
Inline
Side-by-side
hw3d/App.cpp
View file @
9927aeba
...
...
@@ -110,8 +110,39 @@ void App::DoFrame()
// imgui windows to control camera and light
cam
.
SpawnControlWindow
();
light
.
SpawnControlWindow
();
// imgui window to adjust box instance parameters
boxes
.
front
()
->
SpawnControlWindow
(
69
,
wnd
.
Gfx
()
);
// imgui window to open box windows
if
(
ImGui
::
Begin
(
"Boxes"
)
)
{
using
namespace
std
::
string_literals
;
const
auto
preview
=
comboBoxIndex
?
std
::
to_string
(
*
comboBoxIndex
)
:
"Choose a box..."
s
;
if
(
ImGui
::
BeginCombo
(
"Box Number"
,
preview
.
c_str
()
)
)
{
for
(
int
i
=
0
;
i
<
boxes
.
size
();
i
++
)
{
const
bool
selected
=
*
comboBoxIndex
==
i
;
if
(
ImGui
::
Selectable
(
std
::
to_string
(
i
).
c_str
(),
selected
)
)
{
comboBoxIndex
=
i
;
}
if
(
selected
)
{
ImGui
::
SetItemDefaultFocus
();
}
}
ImGui
::
EndCombo
();
}
if
(
ImGui
::
Button
(
"Spawn Control Window"
)
&&
comboBoxIndex
)
{
boxControlIds
.
insert
(
*
comboBoxIndex
);
comboBoxIndex
.
reset
();
}
}
ImGui
::
End
();
// imgui box attribute control windows
for
(
auto
id
:
boxControlIds
)
{
boxes
[
id
]
->
SpawnControlWindow
(
id
,
wnd
.
Gfx
()
);
}
// present
wnd
.
Gfx
().
EndFrame
();
...
...
hw3d/App.h
View file @
9927aeba
...
...
@@ -4,6 +4,7 @@
#include "ImguiManager.h"
#include "Camera.h"
#include "PointLight.h"
#include <set>
class
App
{
...
...
@@ -24,4 +25,6 @@ private:
Camera
cam
;
PointLight
light
;
static
constexpr
size_t
nDrawables
=
180
;
std
::
optional
<
int
>
comboBoxIndex
;
std
::
set
<
int
>
boxControlIds
;
};
\ No newline at end of file
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