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
dbee5401
Commit
dbee5401
authored
Mar 03, 2019
by
chili
Browse files
basic imgui control (imgui capture test)
parent
0c2a85c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
hw3d/App.cpp
View file @
dbee5401
...
@@ -79,16 +79,7 @@ App::App()
...
@@ -79,16 +79,7 @@ App::App()
void
App
::
DoFrame
()
void
App
::
DoFrame
()
{
{
const
auto
dt
=
timer
.
Mark
();
const
auto
dt
=
timer
.
Mark
()
*
speed_factor
;
if
(
wnd
.
kbd
.
KeyIsPressed
(
VK_SPACE
)
)
{
wnd
.
Gfx
().
DisableImgui
();
}
else
{
wnd
.
Gfx
().
EnableImgui
();
}
wnd
.
Gfx
().
BeginFrame
(
0.07
f
,
0.0
f
,
0.12
f
);
wnd
.
Gfx
().
BeginFrame
(
0.07
f
,
0.0
f
,
0.12
f
);
for
(
auto
&
d
:
drawables
)
for
(
auto
&
d
:
drawables
)
...
@@ -96,11 +87,17 @@ void App::DoFrame()
...
@@ -96,11 +87,17 @@ void App::DoFrame()
d
->
Update
(
wnd
.
kbd
.
KeyIsPressed
(
VK_SPACE
)
?
0.0
f
:
dt
);
d
->
Update
(
wnd
.
kbd
.
KeyIsPressed
(
VK_SPACE
)
?
0.0
f
:
dt
);
d
->
Draw
(
wnd
.
Gfx
()
);
d
->
Draw
(
wnd
.
Gfx
()
);
}
}
if
(
show_demo_window
)
static
char
buffer
[
1024
];
// imgui window to control simulation speed
if
(
ImGui
::
Begin
(
"Simulation Speed"
)
)
{
{
ImGui
::
ShowDemoWindow
(
&
show_demo_window
);
ImGui
::
SliderFloat
(
"Speed Factor"
,
&
speed_factor
,
0.0
f
,
4.0
f
);
ImGui
::
Text
(
"Application average %.3f ms/frame (%.1f FPS)"
,
1000.0
f
/
ImGui
::
GetIO
().
Framerate
,
ImGui
::
GetIO
().
Framerate
);
ImGui
::
InputText
(
"Butts"
,
buffer
,
sizeof
(
buffer
)
);
}
}
ImGui
::
End
();
// present
// present
wnd
.
Gfx
().
EndFrame
();
wnd
.
Gfx
().
EndFrame
();
...
...
hw3d/App.h
View file @
dbee5401
...
@@ -17,6 +17,6 @@ private:
...
@@ -17,6 +17,6 @@ private:
Window
wnd
;
Window
wnd
;
ChiliTimer
timer
;
ChiliTimer
timer
;
std
::
vector
<
std
::
unique_ptr
<
class
Drawable
>>
drawables
;
std
::
vector
<
std
::
unique_ptr
<
class
Drawable
>>
drawables
;
bool
show_demo_window
=
true
;
float
speed_factor
=
1.0
f
;
static
constexpr
size_t
nDrawables
=
180
;
static
constexpr
size_t
nDrawables
=
180
;
};
};
\ 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