Talk:VGUI Screen Creation: Difference between revisions
m (Realized you can't modify CreateMove function because g_pClientMode is accessed through the IClientMode interface that shouldn't change.) |
m (New alternative.) |
||
Line 3: | Line 3: | ||
== Fix == | == Fix == | ||
The input fix for the VGUI panel is poorly explained and doesn't address the real issue. I actually had to look at the revision history to see why the fix was needed at all before I could explore it further. The real problem is that <code>CInput::ExtraMouseSample</code> uses a dummy CUserCmd structure that only updates the mouse elements, but leaves the keyboard elements uninitialized at 0. So when <code>g_pClientMode->CreateMove()</code> is called near the end of the function it calls <code>C_BasePlayer::DetermineVguiInputMode()</code> with the bad input. This further explains why this function would be called 4 or 5 times, since it's the engine requesting extra mouse samples. | The input fix for the VGUI panel is poorly explained and doesn't address the real issue. I actually had to look at the revision history to see why the fix was needed at all before I could explore it further. The real problem is that <code>CInput::ExtraMouseSample</code> uses a dummy CUserCmd structure that only updates the mouse elements, but leaves the keyboard elements uninitialized at 0. So when <code>g_pClientMode->CreateMove()</code> is called near the end of the function it calls <code>C_BasePlayer::DetermineVguiInputMode()</code> with the bad input. This further explains why this function would be called 4 or 5 times, since it's the engine requesting extra mouse samples. Another fix might be to add a new member to the ''CUserCmd'' class like <code>bKeybitsvalid</code> that defaults to '''true''', but can be set to '''false''' whenever you do extra mouse samples. That way the validity of the data is stored internally with the structure wherever it may be used and doesn't use a input bit. But that's just my two cents. |
Revision as of 09:53, 27 July 2005
Moved to "Creating a VGUI Screen" because the Entity description for the vgui_screen entity needs to have this page. --King2500 15:45, 14 Jul 2005 (PDT)
Fix
The input fix for the VGUI panel is poorly explained and doesn't address the real issue. I actually had to look at the revision history to see why the fix was needed at all before I could explore it further. The real problem is that CInput::ExtraMouseSample
uses a dummy CUserCmd structure that only updates the mouse elements, but leaves the keyboard elements uninitialized at 0. So when g_pClientMode->CreateMove()
is called near the end of the function it calls C_BasePlayer::DetermineVguiInputMode()
with the bad input. This further explains why this function would be called 4 or 5 times, since it's the engine requesting extra mouse samples. Another fix might be to add a new member to the CUserCmd class like bKeybitsvalid
that defaults to true, but can be set to false whenever you do extra mouse samples. That way the validity of the data is stored internally with the structure wherever it may be used and doesn't use a input bit. But that's just my two cents.