Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Pages: 1 [2]

Author Topic: OIS::Slider  (Read 3321 times)

tgraupmann

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 43
    • View Profile
    • The Code Blog of Tag
Re: OIS::Slider
« Reply #15 on: March 09, 2008, 07:14:09 AM »

You'll be wanting to setup some kind of action binding/user configuration menu. This way, you can let the user move a control to setup a bind action - which in that case you would detect either X or Y axis was moved. Perhaps the Y value is useless anyway, you'll probably be safe with just using the X axis.


Right I have that. I have a key binding configuration menu. I have two joysticks, one with a vertical and one with a horizontal slider. I was only seeing the X axis being set on both. So I've been thinking the absX and absY on the OIS::Slider should just change to abs.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: OIS::Slider
« Reply #16 on: March 09, 2008, 04:16:21 PM »

But, there are two values (at least from what I've seen in directinput API).
Logged

tgraupmann

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 43
    • View Profile
    • The Code Blog of Tag
Re: OIS::Slider
« Reply #17 on: March 09, 2008, 07:23:41 PM »

The docs aren't too useful:
http://msdn2.microsoft.com/en-us/library/bb219640(VS.85).aspx

Quote
dwData
    Data obtained from or sent to the device.

For axis input, if the device is in relative axis mode, the relative axis motion is reported. If the device is in absolute axis mode, the absolute axis coordinate is reported.

For button input, only the low byte of dwData is significant. The high bit of the low byte is set if the button was pressed; it is clear if the button was released.

OIS:
Code: [Select]
case DIJOFS_SLIDER1(0):
sliderMoved[1] = true;
mState.mSliders[1].abX = diBuff[i].dwData;
break;
case DIJOFS_SLIDER1(1):
sliderMoved[1] = true;
mState.mSliders[1].abY = diBuff[i].dwData;
break;
case DIJOFS_SLIDER2(0):
sliderMoved[2] = true;
mState.mSliders[2].abX = diBuff[i].dwData;
break;
case DIJOFS_SLIDER2(1):
sliderMoved[2] = true;
mState.mSliders[2].abY = diBuff[i].dwData;
break;
case DIJOFS_SLIDER3(0):
sliderMoved[3] = true;
mState.mSliders[3].abX = diBuff[i].dwData;
break;
case DIJOFS_SLIDER3(1):
sliderMoved[3] = true;
mState.mSliders[3].abY = diBuff[i].dwData;
break;

Constants:
http://msdn2.microsoft.com/en-us/library/bb174681(VS.85).aspx

Quote
DIJOFS_SLIDER(n)     Slider axis

How big is n? What made you pick 2?
« Last Edit: March 09, 2008, 07:27:30 PM by tgraupmann »
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: OIS::Slider
« Reply #18 on: March 10, 2008, 02:56:14 PM »

The 2 comes from the joystick structure used by DirectInput:

    LONG rglSlider[2];
...
    LONG rglVSlider[2];
...
    LONG rglASlider[2];
...
    LONG rglFSlider[2];

From SDK docs:
rglSlider:
Two additional axis values (formerly called the u-axis and v-axis) whose semantics depend on the joystick. Use the IDirectInputDevice8::GetObjectInfo method to obtain semantic information about these values.

So, there you have it. Some sliders come in as two values. Probably, no device uses the second Axis? so probably best to ignore it. Though, I don't think it would be good to ignore it within OIS. GetObjectInfo might prove to tell if both axes are returning values or not, but that still would not change the definition of the OIS slider structure I don't think

Also, since I think your slider issue seems to be basically fixed, I will start preparing an official release tonight! Well, no big party, but get some release updates there and then features can be added (xbox 360 support, Linux Force Feedback, etc) in updates from there.
« Last Edit: March 10, 2008, 02:57:55 PM by pjcast »
Logged

tgraupmann

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 43
    • View Profile
    • The Code Blog of Tag
Re: OIS::Slider
« Reply #19 on: March 10, 2008, 07:05:59 PM »

IDirectInputDevice8::GetObjectInfo Method
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c_Dec_2004/directx/input/ref/ifaces/idirectinputdevice9/getobjectinfo.asp

Is this method being called to make sure the device is DI_OK?

Quote
Return Value

    If the method succeeds, the return value is DI_OK.

    If the method fails, the return value can be one of the following error values:

    DIERR_INVALIDPARAM   An invalid parameter was passed to the returning function, or the object was not in a state that permitted the function to be called. This value is equal to the E_INVALIDARG standard Component Object Model (COM) return value.
    DIERR_NOTINITIALIZED   The object has not been initialized.
    DIERR_OBJECTNOTFOUND   The requested object does not exist.
    E_POINTER   An invalid pointer, usually NULL, was passed as a parameter.
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Re: OIS::Slider
« Reply #20 on: March 11, 2008, 08:35:14 AM »

I do not remember actually ever checking, in OIS, is there something you can call to ask if something exists, like a slider or axis or mouse button or what-not?
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: OIS::Slider
« Reply #21 on: March 11, 2008, 10:03:04 AM »

Yup.

Check the JoyStick class API docs - getNumberOfComponents (here).
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: OIS::Slider
« Reply #22 on: March 11, 2008, 10:04:49 AM »

However, since keyboard and mice are pretty much standard, there is no querying them for what buttons they support. Mice are assumed to have maximum 3 axes, and I think (edit) 8 buttons. Keyboards have maximum 256 buttons, though will be quite lower and is limited to Enum Keycodes.
« Last Edit: March 11, 2008, 01:44:49 PM by pjcast »
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Re: OIS::Slider
« Reply #23 on: March 11, 2008, 01:14:12 PM »

8 mouse buttons, which is what the win32 api allows, which is what your class allows (which I know because my mouse has 7 buttons).
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: OIS::Slider
« Reply #24 on: March 11, 2008, 01:45:01 PM »

Fixed :)
Logged
Pages: 1 [2]