Talk:VGUI Screen Creation
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)
Contents
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. Zipster
I would just like to thank Helk and Zipster for fixing my ugly hack of a solution :) My way worked, but their ways are more practical and less likely to cause bugs. Do what they said :-P
--TJMonk15 8:05, 28 Jul 2005 (EST)
Does CS:S bomb use a vgui screen?—ts2do 14:24, 10 Mar 2006 (PST)
Alright...I programmed a less hacky way to handle this....I'll get it posted up here ASAP—ts2do 15:02, 11 Mar 2006 (PST)
Detail
Can someone please enlighten this with a tutorial on actually making a working screen in code (not the code changes, but it's own class, etc.) as well as the res file? I can get it to show the test screen but not my own, I'm so confused.. --AndrewNeo 21:09, 13 Apr 2006 (PDT)
Expansion
Can someone report if their vgui controls actually do anything? They don't for mine, it looks like it's just an image... It would be much more helpful if we can get a custom game dialog in (VGUI2: Creating a panel), but can you even use any of the controls that appear on the vgui_screen dialog? --Daedalus 02:30, 28 Dec 2006 (PST)
In order to handle the messages from the vgui_screen, you'll need to implement the CVGuiScreenPanel::OnMessage
function. To do so, you need to add:
virtual void OnMessage(const KeyValues *params, vgui::VPANEL fromPanel);
in c_vguiscreen.h
under the public member functions of CVguiScreenPanel. Then you'll need to add the implementation of it:
void CVGuiScreenPanel::OnMessage(const KeyValues *params, vgui::VPANEL fromPanel) { /*todo: check the params and handle them*/ }
in c_vguiscreen.cpp
. Hope that helps! (This is my first wiki edit ever! :P)
--Glorfindel 09:30, 14 Feb 2006 (EST)
Respawn Bug in Fix
The current fix given in this wiki contains a bug that will not let you respawn. This is because the respawning code checks to see if you have released all keys before it respawns you. The fix is pretty simple.
In ..\src\dlls\player.cpp
Replace:
int fAnyButtonDown = (m_nButtons & ~IN_SCORE);
with:
int fAnyButtonDown = (m_nButtons & ~IN_SCORE & ~IN_VALIDVGUIINPUT);
That seemed to do the trick for me. Hope this helps! --Glorfindel 09:30, 14 Feb 2006 (EST)