Commit 73eda06a authored by chili's avatar chili
Browse files

small tweaks (noexcept and win -> chiliwin.h)

parent 3b34901a
......@@ -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();
}
......@@ -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
......@@ -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
......
......@@ -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 );
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment