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: Joystick axis enumeration order  (Read 5452 times)

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Re: Joystick axis enumeration order
« Reply #15 on: October 19, 2007, 09:21:11 AM »

Slider's are still an axis as far as I am concerned, identical functionality.
And you can use that to map the proper axis to the index; still, the index for the api side is best.
Logged

gjaegy

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 29
    • View Profile
Re: Joystick axis enumeration order
« Reply #16 on: October 20, 2007, 02:36:47 AM »

I also consider slider as an axis, sorry I guess my explanation wasn't clear.

My issue is, how could I know which index I should use for retrieving its value ?

If an enum contains a SLIDER semantic, it is much easier.

Do you get what I mean ?
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Re: Joystick axis enumeration order
« Reply #17 on: October 21, 2007, 01:36:16 AM »

And yet I still do not see the point, that all seems like front-end mess, nothing to do with the clean backend...
Logged

gjaegy

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 29
    • View Profile
Re: Joystick axis enumeration order
« Reply #18 on: October 21, 2007, 03:00:33 AM »

OK, so what would be your solution to get the index that need to be used to retrieve the value of a slider ?

Critism is good, but only if it brings some better solution.
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Re: Joystick axis enumeration order
« Reply #19 on: October 21, 2007, 10:35:56 AM »

Personally if I built it then I would use the standard index for all possible slider/axis/etc. things for the main interface.  Also, create an interface struct that you could retrieve from the joystick object that describes which axis does which, so something akin to:
Code: [Select]
IndexInfo indexInfo1 = joystick1->GetIndexInformation();

// and you would still do the standard buffered callbacks and so forth (in the current style of using a single callback for all axis with the index being passed in as well), but in your gui you could do things like:
if(indexInfo1.axisX != -1) possibleBindingListInGui.push(joystickaxispair("Axis X", indexInfo1.axisX);
if(indexInfo1.slider2 != -1) possibleBindingListInGui.push(joystickaxispair("Slider 2", indexInfo1.slider2);

// Although a better interface being future proof for later control styles (more axis or different names or whatever) would be to just query it with a string, although you would want to precalc that early on like:
this->axisX = indexInfo1["AxisX"]; // if -1 then unusable, just test your own axisX value later on for if it is -1 or not to see if it is a valid index, if it is then the index in the axis list, such as that passed into the buffered callback, would equal this if it is this
this->axisX = indexInfo1["Axis Left/Right"]; // Depending on the object, it could bind different names if it used a unique interface, such as with one of those 6dof controllers with a unique internal API, whereas it should also properly bind to AxisX as well, can bind to as many names internally as it should wish, but always preferably supporting a basic subset
this->axisX
this->slider2 = indexInfo1["Slider2"];

// Then do the same as above for your gui stuff
if(this.axisX != -1) possibleBindingListInGui.push(joystickaxispair("Axis X", this.axisX);
if(this.slider2 != -1) possibleBindingListInGui.push(joystickaxispair("Slider 2", this.slider2);

As stated above, stuff that it dealt with for the user gui (to do all their binding and other such mess), but not stuff that is messed with for normal game logic.
« Last Edit: October 21, 2007, 10:38:14 AM by OvermindDL1 »
Logged

gjaegy

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 29
    • View Profile
Re: Joystick axis enumeration order
« Reply #20 on: November 06, 2007, 11:08:42 PM »

I don`t really mind the way it is implemented, but I really need to get acces to this information somehow.

pjcast, any news from your side ? considering adding this to a future release ?
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: Joystick axis enumeration order
« Reply #21 on: November 17, 2007, 12:52:31 PM »

I have yet to have a chance to really examine the code changes. There exists the possibility of adding it, but no time schedule on that. Feel free to use the patch and see how it fits your needs. OIS is completely open and feel free to modify parts of it that better fit your needs ;)
Logged
Pages: 1 [2]