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
73eda06a
Commit
73eda06a
authored
Dec 26, 2018
by
chili
Browse files
small tweaks (noexcept and win -> chiliwin.h)
parent
3b34901a
Changes
5
Hide whitespace changes
Inline
Side-by-side
hw3d/ChiliTimer.cpp
View file @
73eda06a
...
...
@@ -2,12 +2,12 @@
using
namespace
std
::
chrono
;
ChiliTimer
::
ChiliTimer
()
ChiliTimer
::
ChiliTimer
()
noexcept
{
last
=
steady_clock
::
now
();
}
float
ChiliTimer
::
Mark
()
float
ChiliTimer
::
Mark
()
noexcept
{
const
auto
old
=
last
;
last
=
steady_clock
::
now
();
...
...
@@ -15,7 +15,7 @@ float ChiliTimer::Mark()
return
frameTime
.
count
();
}
float
ChiliTimer
::
Peek
()
const
float
ChiliTimer
::
Peek
()
const
noexcept
{
return
duration
<
float
>
(
steady_clock
::
now
()
-
last
).
count
();
}
hw3d/ChiliTimer.h
View file @
73eda06a
...
...
@@ -4,9 +4,9 @@
class
ChiliTimer
{
public:
ChiliTimer
();
float
Mark
();
float
Peek
()
const
;
ChiliTimer
()
noexcept
;
float
Mark
()
noexcept
;
float
Peek
()
const
noexcept
;
private:
std
::
chrono
::
steady_clock
::
time_point
last
;
};
\ No newline at end of file
hw3d/Window.cpp
View file @
73eda06a
...
...
@@ -122,7 +122,7 @@ std::optional<int> Window::ProcessMessages()
if
(
msg
.
message
==
WM_QUIT
)
{
// return optional wrapping int (arg to PostQuitMessage is in wparam) signals quit
return
msg
.
wParam
;
return
(
int
)
msg
.
wParam
;
}
// TranslateMessage will post auxilliary WM_CHAR messages from key msgs
...
...
hw3d/WindowsMessageMap.cpp
View file @
73eda06a
...
...
@@ -18,7 +18,6 @@
* along with The Chili Direct3D Engine. If not, see <http://www.gnu.org/licenses/>. *
******************************************************************************************/
#include "WindowsMessageMap.h"
#include <Windows.h>
#include <string>
#include <sstream>
#include <iomanip>
...
...
@@ -33,7 +32,7 @@
#define REGISTER_MESSAGE(msg){msg,#msg}
WindowsMessageMap
::
WindowsMessageMap
()
WindowsMessageMap
::
WindowsMessageMap
()
noexcept
:
map
(
{
REGISTER_MESSAGE
(
WM_CREATE
),
...
...
@@ -168,15 +167,6 @@ WindowsMessageMap::WindowsMessageMap()
REGISTER_MESSAGE
(
WM_QUERYNEWPALETTE
),
REGISTER_MESSAGE
(
WM_PALETTEISCHANGING
),
REGISTER_MESSAGE
(
WM_PALETTECHANGED
),
REGISTER_MESSAGE
(
WM_DDE_INITIATE
),
REGISTER_MESSAGE
(
WM_DDE_TERMINATE
),
REGISTER_MESSAGE
(
WM_DDE_ADVISE
),
REGISTER_MESSAGE
(
WM_DDE_UNADVISE
),
REGISTER_MESSAGE
(
WM_DDE_ACK
),
REGISTER_MESSAGE
(
WM_DDE_DATA
),
REGISTER_MESSAGE
(
WM_DDE_REQUEST
),
REGISTER_MESSAGE
(
WM_DDE_POKE
),
REGISTER_MESSAGE
(
WM_DDE_EXECUTE
),
REGISTER_MESSAGE
(
WM_DROPFILES
),
REGISTER_MESSAGE
(
WM_POWER
),
REGISTER_MESSAGE
(
WM_WINDOWPOSCHANGED
),
...
...
@@ -219,7 +209,7 @@ WindowsMessageMap::WindowsMessageMap()
}
)
{}
std
::
string
WindowsMessageMap
::
operator
()(
DWORD
msg
,
LPARAM
lp
,
WPARAM
wp
)
const
std
::
string
WindowsMessageMap
::
operator
()(
DWORD
msg
,
LPARAM
lp
,
WPARAM
wp
)
const
noexcept
{
constexpr
int
firstColWidth
=
25
;
const
auto
i
=
map
.
find
(
msg
);
...
...
hw3d/WindowsMessageMap.h
View file @
73eda06a
...
...
@@ -19,13 +19,13 @@
******************************************************************************************/
#pragma once
#include <unordered_map>
#include
<Windows
.h
>
#include
"ChiliWin
.h
"
class
WindowsMessageMap
{
public:
WindowsMessageMap
();
std
::
string
operator
()(
DWORD
msg
,
LPARAM
lp
,
WPARAM
wp
)
const
;
WindowsMessageMap
()
noexcept
;
std
::
string
operator
()(
DWORD
msg
,
LPARAM
lp
,
WPARAM
wp
)
const
noexcept
;
private:
std
::
unordered_map
<
DWORD
,
std
::
string
>
map
;
};
\ 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