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
19b128c2
Commit
19b128c2
authored
Dec 09, 2018
by
chili
Browse files
cosmetic twerks and comments
parent
feed6bf4
Changes
2
Hide whitespace changes
Inline
Side-by-side
hw3d/WinMain.cpp
View file @
19b128c2
...
@@ -32,14 +32,17 @@ int CALLBACK WinMain(
...
@@ -32,14 +32,17 @@ int CALLBACK WinMain(
BOOL
gResult
;
BOOL
gResult
;
while
(
(
gResult
=
GetMessage
(
&
msg
,
nullptr
,
0
,
0
))
>
0
)
while
(
(
gResult
=
GetMessage
(
&
msg
,
nullptr
,
0
,
0
))
>
0
)
{
{
// TranslateMessage will post auxilliary WM_CHAR messages from key msgs
TranslateMessage
(
&
msg
);
TranslateMessage
(
&
msg
);
DispatchMessage
(
&
msg
);
DispatchMessage
(
&
msg
);
}
}
// check if GetMessage call itself borked
if
(
gResult
==
-
1
)
if
(
gResult
==
-
1
)
{
{
return
-
1
;
return
-
1
;
}
}
// wParam here is the value passed to PostQuitMessage
return
msg
.
wParam
;
return
msg
.
wParam
;
}
}
\ No newline at end of file
hw3d/Window.cpp
View file @
19b128c2
...
@@ -85,7 +85,7 @@ Window::~Window()
...
@@ -85,7 +85,7 @@ Window::~Window()
DestroyWindow
(
hWnd
);
DestroyWindow
(
hWnd
);
}
}
LRESULT
WINAPI
Window
::
HandleMsgSetup
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
noexcept
LRESULT
CALLBACK
Window
::
HandleMsgSetup
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
noexcept
{
{
// use create parameter passed in from CreateWindow() to store window class pointer at WinAPI side
// use create parameter passed in from CreateWindow() to store window class pointer at WinAPI side
if
(
msg
==
WM_NCCREATE
)
if
(
msg
==
WM_NCCREATE
)
...
@@ -104,7 +104,7 @@ LRESULT WINAPI Window::HandleMsgSetup( HWND hWnd,UINT msg,WPARAM wParam,LPARAM l
...
@@ -104,7 +104,7 @@ LRESULT WINAPI Window::HandleMsgSetup( HWND hWnd,UINT msg,WPARAM wParam,LPARAM l
return
DefWindowProc
(
hWnd
,
msg
,
wParam
,
lParam
);
return
DefWindowProc
(
hWnd
,
msg
,
wParam
,
lParam
);
}
}
LRESULT
WINAPI
Window
::
HandleMsgThunk
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
noexcept
LRESULT
CALLBACK
Window
::
HandleMsgThunk
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
noexcept
{
{
// retrieve ptr to window class
// retrieve ptr to window class
Window
*
const
pWnd
=
reinterpret_cast
<
Window
*>
(
GetWindowLongPtr
(
hWnd
,
GWLP_USERDATA
));
Window
*
const
pWnd
=
reinterpret_cast
<
Window
*>
(
GetWindowLongPtr
(
hWnd
,
GWLP_USERDATA
));
...
@@ -116,6 +116,8 @@ LRESULT Window::HandleMsg( HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam ) noex
...
@@ -116,6 +116,8 @@ LRESULT Window::HandleMsg( HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam ) noex
{
{
switch
(
msg
)
switch
(
msg
)
{
{
// we don't want the DefProc to handle this message because
// we want our destructor to destroy the window, so return 0 instead of break
case
WM_CLOSE
:
case
WM_CLOSE
:
PostQuitMessage
(
0
);
PostQuitMessage
(
0
);
return
0
;
return
0
;
...
...
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