Thanks! I've noticed this a while ago, but I kept telling myself there had
to be a cleaner way of doing this... guess not :(

Hardcoding, here i go!

From: "Paul Peloski" <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: [hlcoders] Rerouting VGUI key events to the HL2 engine
Date: Tue, 18 Jul 2006 14:47:51 -0400

--
[ Picked text/plain from multipart/alternative ]
Instead of using SetKeyboardInputEnabled, try what Valve does for the
weapon
selection HUD, in ClientModeShared::KeyInput. Make a global accessor for
your hotkey panel and make a KeyInput function for it, then call that
KeyInput function and use the return value to determine whether the panel
ate the keystroke or whether the keystroke should be processed by the
engine
(KeyInput returns 0 when the engine can't have the key and 1 when it can).
I
believe this is how you do what you want since once VGUI is overriding the
keystrokes I don't think you can pass them back to the engine the way you
want.

Message: 6
> From: "William Ravaine" <[EMAIL PROTECTED]>
> To: [email protected]
> Date: Tue, 18 Jul 2006 13:51:47 +0200
> Subject: [hlcoders] Rerouting VGUI key events to the HL2 engine
> Reply-To: [email protected]
>
> Hi guys,
>
> Im trying to implement a kind of hotkey system for my ingame panels, but
> Ive
> run into an annoying issue: as soon as a panel is given keyboard input
> rights (SetKeyboardInputEnabled true), all the key events are swallowed
by
> the panel. This was expected though, but the problem Im having is that I
> can't find a way of redirecting to the HL2 client the key events I dont
> handle in the panels. I've tried using engine->GetLastPressedEngineKey()
> and
> engine->Key_Event( iLastTrappedKey, false ) to fake it, but it doesnt
seem
> to have any effect. Here's how Im using it:
>
> void MyPanel::OnKeyCodeTyped(KeyCode code)
> {
>         if( code == KEY_ESCAPE )
>               ShowPanel( false );
>         else
>         {
>                 int iLastTrappedKey = engine->GetLastPressedEngineKey();
>                 engine->Key_Event( iLastTrappedKey, false );
>         }
> }
>
> Any ideas/suggestions welcome!
>
> - Spk
>
--

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders




_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to