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
6e0a7911
Commit
6e0a7911
authored
Dec 26, 2018
by
chili
Browse files
add chili timer
parent
83156329
Changes
4
Hide whitespace changes
Inline
Side-by-side
hw3d/ChiliTimer.cpp
0 → 100644
View file @
6e0a7911
#include "ChiliTimer.h"
using
namespace
std
::
chrono
;
ChiliTimer
::
ChiliTimer
()
{
last
=
steady_clock
::
now
();
}
float
ChiliTimer
::
Mark
()
{
const
auto
old
=
last
;
last
=
steady_clock
::
now
();
const
duration
<
float
>
frameTime
=
last
-
old
;
return
frameTime
.
count
();
}
float
ChiliTimer
::
Peek
()
const
{
return
duration
<
float
>
(
steady_clock
::
now
()
-
last
).
count
();
}
hw3d/ChiliTimer.h
0 → 100644
View file @
6e0a7911
#pragma once
#include <chrono>
class
ChiliTimer
{
public:
ChiliTimer
();
float
Mark
();
float
Peek
()
const
;
private:
std
::
chrono
::
steady_clock
::
time_point
last
;
};
\ No newline at end of file
hw3d/hw3d.vcxproj
View file @
6e0a7911
...
...
@@ -147,6 +147,7 @@
<ItemGroup>
<ClCompile
Include=
"App.cpp"
/>
<ClCompile
Include=
"ChiliException.cpp"
/>
<ClCompile
Include=
"ChiliTimer.cpp"
/>
<ClCompile
Include=
"Keyboard.cpp"
/>
<ClCompile
Include=
"Mouse.cpp"
/>
<ClCompile
Include=
"Window.cpp"
/>
...
...
@@ -156,6 +157,7 @@
<ItemGroup>
<ClInclude
Include=
"App.h"
/>
<ClInclude
Include=
"ChiliException.h"
/>
<ClInclude
Include=
"ChiliTimer.h"
/>
<ClInclude
Include=
"ChiliWin.h"
/>
<ClInclude
Include=
"Keyboard.h"
/>
<ClInclude
Include=
"Mouse.h"
/>
...
...
hw3d/hw3d.vcxproj.filters
View file @
6e0a7911
...
...
@@ -36,6 +36,9 @@
<ClCompile
Include=
"App.cpp"
>
<Filter>
Source Files
</Filter>
</ClCompile>
<ClCompile
Include=
"ChiliTimer.cpp"
>
<Filter>
Source Files
</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"WindowsMessageMap.h"
>
...
...
@@ -62,6 +65,9 @@
<ClInclude
Include=
"App.h"
>
<Filter>
Header Files
</Filter>
</ClInclude>
<ClInclude
Include=
"ChiliTimer.h"
>
<Filter>
Header Files
</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile
Include=
"hw3d.rc"
>
...
...
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