In the HumanView class we have function which handles application messages
Display All
First we ask screens to handle the message, then the big switch is used to pass message to various input handlers.
Quote from the book, page 279
Also on the page 242 (input chapter) we can find that
The LRESULT result = 0; is assigned from the input handler call however it isn't used and 0 is always returned. Is it the bug or I miss something?
As I see it, only HumanViews can consume input messages, and if there is only one HumanView (no split screen) and it returns 0 from the function, the loop inside main WndProc will not break however this is just slight performance drop.
Source Code
- //
- // HumanView::VOnMsgProc - Chapter 10, page 279
- //
- LRESULT CALLBACK HumanView::VOnMsgProc( AppMsg msg )
- {
- // Iterate through the screen layers first
- // In reverse order since we'll send input messages to the
- // screen on top
- for(ScreenElementList::reverse_iterator i=m_ScreenElements.rbegin(); i!=m_ScreenElements.rend(); ++i)
- {
- if ( (*i)->VIsVisible() )
- {
- if ( (*i)->VOnMsgProc( msg ) )
- {
- return 1;
- }
- }
- }
- LRESULT result = 0;
- switch (msg.m_uMsg)
- {
- case WM_KEYDOWN:
- if (m_Console.IsActive())
- {
- // Let the console eat this.
- }
- else if (m_KeyboardHandler)
- {
- result = m_KeyboardHandler->VOnKeyDown(static_cast<const BYTE>(msg.m_wParam));
- }
- break;
- ...
- default:
- return 0;
- }
- return 0;
- }
First we ask screens to handle the message, then the big switch is used to pass message to various input handlers.
Quote from the book, page 279
Back to the implementation of HumanView::VOnMsgProc(). Its job is to iterate through the list of screens attached to it, forward the message on to the visible ones, and if they dont eat the message, then ask the pointer and keyboard handler if they can consume it.
Also on the page 242 (input chapter) we can find that
If the message is handled, the functions return true; otherwise, they return false.
The LRESULT result = 0; is assigned from the input handler call however it isn't used and 0 is always returned. Is it the bug or I miss something?
As I see it, only HumanViews can consume input messages, and if there is only one HumanView (no split screen) and it returns 0 from the function, the loop inside main WndProc will not break however this is just slight performance drop.
Looking for a job!
My LinkedIn Profile
My LinkedIn Profile