Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: EventCallback and getID  (Read 431 times)

Nimos

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
EventCallback and getID
« on: May 13, 2010, 07:32:36 AM »

Hi,

I'm writing an input mapping library and I'm currently working to support OIS as one of the backends.

I've got two questions/feature suggestions:

1. The callback function for gamepad button events takes two arguments a JoyStickEvent  and the button index.
Is there some information in the JoyStickEvent that I can use determine which gamepad the event originated from? I thought device->getID would be the one, but it only returns -1. Or do I have to use different callback functions for each gamepad?

2. Is it possible to change input grab mode without having to destroy the input manager?
I see that some classes, for example LinuxMouse, seems to have methods that supports this. But could it be done system wide in a platform independent fashion? Maybe exposed as methods in the input manager?

Regards
Nimos
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: EventCallback and getID
« Reply #1 on: May 16, 2010, 09:13:42 AM »

1. You can use the device base member on the EventArg class. This is the joystick (or device) that triggered the event. You could use a [Object*] as the key to your map. Works with all devices, not just joysticks.

2. There is no uniform platform way to change this at run time. For Windows, for example, it would mean recreating the DirectInput interface.
Logged

Nimos

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Re: EventCallback and getID
« Reply #2 on: May 17, 2010, 11:28:13 AM »

Thanks for the response!

1. Okay, I'll use that approach then.

2. I understand.

3. Another question popped up:
(Edit: Rephrased question.)
Could key repetition be enabled/disabled after initialization of the input manager or does the answer for question 2 apply here too?
« Last Edit: May 17, 2010, 12:09:12 PM by Nimos »
Logged