Author Topic:   GUI input
Bwuce Wee
posted February 08, 2000 08:03 AM            
I'm about to develop the GUI for my systems, with DirectX 3
(Dont ask why... I dont have a choice on NT4)
(And dont ask why I have to use NT4 either!)

The thing I was wondering about is how you guys manage the events (mouse, keyboard, etc)
for a GUI.
Do you create your own events and pass them around?
Or just pass the windows events around?

Basically, I'm not too certain how to go about the messaging/event handling part of the GUI.

Light? I haven't even found the tunnel!!


posted February 12, 2000 08:31 PM            
Well I've not worked with directdraw, but input handling should be similar.
Basically what I do is I have a BOOL array of 256 elements 1 per possible ascii input.. could get away with 128 I'm sure tho.
On WM_KEYDOWN messages I modify the corresponding array element inverse for WM_KEYUP messages.. Then in my input proc I just check for appropriate key states.
For Mouse.. I have a struct for the 3 buttons and pointer coords. during WM_MBUTTON messages I change the struct values. Then do about the same thing as my keyboard routine in the input proc.
I don't use DirectInput anymore. Using DInput from DX3 would have been a lot more difficult than generic windows handling, and anything higher than DX3 don't work with NT. But when I did have Directinput in my code I handled the devices about the same.. Except when the input proc started I checked grabbed the keyboard/mouse/joystick states, as opposed to using the WM messages. Others may do things a lot differently than me, and may have better ways of doing it, but that works for me. Hope it helps.