I've been looking for a generic method to hook special USB keyboards and other controllers to my app and finally ended up playing with the GameInputManager. I just a search on the forum with that word and got only 4 threads as result. Either this means nobody has ever had any problems with the class or that very few people actually uses it. Somehow the latter sounds more probable, especially since the examples in LR are a tad vague.
Anyway, my problem is simple: how do I get an event out of any element in a device I know by name? I was surprised how complicated this was since one could assume that a game input device would be just like any other control and provide events in the same way. The best solution I got so far was to create a class, make that a thread, create event interfaces as 'action' and 'connected' and then put the following code in the run handler:
dim i as integer
if mManager=nil then
//look for device that identifies itself as name xkeys that can have up to 88 keys
for i=0 to mManager.DeviceCount-1
if mManager.device(i).name="xkeys" then
if mManager.Device(DeviceIndex).Connected then
for i=0 to 87
if mManager.device(DeviceIndex).Element(i).Value=1 and PreviousValue(i)=0 then
if mManager.device(DeviceIndex).Element(i).Value=0 and PreviousValue(i)=1 then
Loop Until Window1=nil
There has to be an easier way to get notified if a user hits certain element than browsing through all the devices and elements in an continuous loop.
EDIT: I'm not sure if this would be the only solution but I added a feature request to add a couple of events in the GameInputManager to make it more like a control. If you agree, add this in your watch list:
http://www.realsoftware.com/feedback/vi ... d=raknenrt