Game Development Community

Hwo to catch the Keyup message in Engine code?

by Prodigy Andy · in Torque Game Engine · 11/14/2006 (1:12 am) · 2 replies

I can catch the keyup message in winWindow::processKeyMessage() by using following code:

static void processKeyMessage(UINT message, WPARAM wParam, LPARAM lParam)

if (message == WM_KEYUP)
	  {Con::printf("It is keyup message!" );}

But I can't catch the keyup message in winWindow::ProcessMessages() by using the same method.
It's so strange because all keyboard message are sent to processKeyMessage() through ProcessMessages() .

Thanks.

Andy

#1
11/15/2006 (12:43 pm)
The reason this is happening is that because say you're talking about the PlayGui ctrl. In that you got the GuiShapeNameHud which is basically eating away your input that could otherwise be passed onto PlayGui. To fix this (for the case of PlayGui, you didn't give an exact requirement). You would first need to implement:
virtual bool onKeyDown(const GuiEvent &event);
virtual bool onKeyUp(const GuiEvent &event);

for GameTSCtrl

then you will ensure that the GuiShapeNameHud passes input through via the modal flag.

Basic idea is that make sure something else isn't eating up your input, and all GuiControls can re-implement input virtual methods for mouse & keyboard.
#2
11/15/2006 (12:50 pm)
Andy -

hmm, interesting.

Looks like processKeyMessage() being called from OurDispatchMessages() in winWindow.cc,
which is emptying the sgWinMessages queue.