[SOLVED]Joystick - Gamepad... general question
-
iblues1976
- Gnome
- Posts: 379
- Joined: Fri Sep 16, 2011 4:54 pm
- x 10
[SOLVED]Joystick - Gamepad... general question
Hi,
As I'm developing my 3D scene, I want to add some additional input. My final goal is multi-touch, but I want to move from keyboard+mouse to joystick.
I have program before the xbox 360 controller with xna and I already read the threads about joysticks/gamepads here in the forum.
I guess there are multiple options... OIS, SDL...
What are you guys using for input, in specific joystick/gamepad.
I'm going to try both (OIS and SDL) and see which one I like better. Since I was already using OIS for keyboard + mouse, I was thinking to try that first.
I'm going to buy a controller, since the xbox 360 with cable, my nephew took them (well, I gave them those...)
What are you guys using for Ogre? any preference? I really need one with two joysticks, like the 360. I think I will get another one of those... However, this looks nice: http://www.amazon.com/Logitech-940-0001 ... 75&sr=8-18
thanks,
Francisco
PS -> Moderator:I think this thread is best here in general, but feel free to move it, if you think is not in the right place.
As I'm developing my 3D scene, I want to add some additional input. My final goal is multi-touch, but I want to move from keyboard+mouse to joystick.
I have program before the xbox 360 controller with xna and I already read the threads about joysticks/gamepads here in the forum.
I guess there are multiple options... OIS, SDL...
What are you guys using for input, in specific joystick/gamepad.
I'm going to try both (OIS and SDL) and see which one I like better. Since I was already using OIS for keyboard + mouse, I was thinking to try that first.
I'm going to buy a controller, since the xbox 360 with cable, my nephew took them (well, I gave them those...)
What are you guys using for Ogre? any preference? I really need one with two joysticks, like the 360. I think I will get another one of those... However, this looks nice: http://www.amazon.com/Logitech-940-0001 ... 75&sr=8-18
thanks,
Francisco
PS -> Moderator:I think this thread is best here in general, but feel free to move it, if you think is not in the right place.
Last edited by iblues1976 on Tue Feb 21, 2012 7:21 pm, edited 1 time in total.
-
Padres
- Gnoblar
- Posts: 17
- Joined: Mon Oct 17, 2011 8:54 am
- x 2
Re: Joystick - Gamepad... general question
Hi,
For XBox gamepad I'm using XInput: http://www.ogre3d.org/forums/viewtopic.php?f=5&t=48134
Stefan
For XBox gamepad I'm using XInput: http://www.ogre3d.org/forums/viewtopic.php?f=5&t=48134
Stefan
-
iblues1976
- Gnome
- Posts: 379
- Joined: Fri Sep 16, 2011 4:54 pm
- x 10
Re: Joystick - Gamepad... general question
That's nice... I will look into it...
-
Kojack
- OGRE Moderator

- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 538
Re: Joystick - Gamepad... general question
For 360 controllers, XInput is mind numbingly easy. It's probably the simplest api microsoft has ever released. Very cool.
However it's also limited to only 360 controllers.
Direct Input based systems (like OIS, unless they've changed, I haven't looked at the code for a few years) are more flexible because they can handle most joystick style devices in a generic way (so other gamepads can be used, or real flight sim joysticks, etc). 360 controllers work with that too. But there's a down side. 360 controller support in direct input is intentionally poor. Many features of the 360 controller aren't available, such as vibrate, audio in/out mic port, and the triggers are merged together as a single value ( -left + right ) so if you pull both triggers the same amount it returns 0. The only way to use a 360 controller properly is XInput (unless you go to the usb level and directly access it).
One thing that really annoys me is games that allow a choice of just mouse/keyboard or 360. They have analog movement (so variable speed and direction) when using a 360 controller, but the alternative is digital 8 direction control with keyboard. I have a Logitech G13 game board thingy. It's a mini keyboard, lcd screen, and a thumb joystick. I like the thumb stick for movement, but most games don't accept analog from anything but a 360 controller, so I have to emulate WASD on it.
Chronicles Of Riddick games and Splinter Cell Chaos Theory support any joystick device for movement. They rock.
Later splinter cells removed it (360 or keyboard, no joysticks).
The best way for really flexible controls is both direct input and xinput. Use direct input for any joystick device, and xinput for 360 controllers. Best of both worlds.
Don't use direct input for keyboard and mouse though (like OIS does), microsoft recommend against it. They say the best way is raw input windows messages, it has less limits and is faster (internally direct input uses the same raw messages then adds extra code on top, you might as well do it directly and avoid the bloat).
My absolute favourite input device for ogre is the 3D Connexion Space Pilot Pro. Costs a heap (they give teacher discounts which is cool for me) but it's just so damn cool. One hand gives extremely precise analog control of pitch, yaw, roll, x/y/z translation, plus it's got a heap of buttons. It can emulate a mouse, joystick (direct input), keyboard, or be used directly with it's sdk or raw input messages (I use the latter). All the cheaper models are good too, but the ones without a hand rest are more likely to move around your table when pulling up on the control puck.
Overall... I'm not really sure what to recommend. I've never used SDL's input, I rarely use OIS. Instead I wrote my own input library (it's not available to the public).
Although I'm interested in trying a thing called VRPN which was mentioned twice on this forum recently. It's apparently an input system for virtual reality apps that supports keyboard, mouse, joysticks, 360 controller, 3d connexion, vr gloves, wiimotes, etc. It's got a big list of freaky devices I've never heard of. Could be cool.
However it's also limited to only 360 controllers.
Direct Input based systems (like OIS, unless they've changed, I haven't looked at the code for a few years) are more flexible because they can handle most joystick style devices in a generic way (so other gamepads can be used, or real flight sim joysticks, etc). 360 controllers work with that too. But there's a down side. 360 controller support in direct input is intentionally poor. Many features of the 360 controller aren't available, such as vibrate, audio in/out mic port, and the triggers are merged together as a single value ( -left + right ) so if you pull both triggers the same amount it returns 0. The only way to use a 360 controller properly is XInput (unless you go to the usb level and directly access it).
One thing that really annoys me is games that allow a choice of just mouse/keyboard or 360. They have analog movement (so variable speed and direction) when using a 360 controller, but the alternative is digital 8 direction control with keyboard. I have a Logitech G13 game board thingy. It's a mini keyboard, lcd screen, and a thumb joystick. I like the thumb stick for movement, but most games don't accept analog from anything but a 360 controller, so I have to emulate WASD on it.
Chronicles Of Riddick games and Splinter Cell Chaos Theory support any joystick device for movement. They rock.
The best way for really flexible controls is both direct input and xinput. Use direct input for any joystick device, and xinput for 360 controllers. Best of both worlds.
Don't use direct input for keyboard and mouse though (like OIS does), microsoft recommend against it. They say the best way is raw input windows messages, it has less limits and is faster (internally direct input uses the same raw messages then adds extra code on top, you might as well do it directly and avoid the bloat).
My absolute favourite input device for ogre is the 3D Connexion Space Pilot Pro. Costs a heap (they give teacher discounts which is cool for me) but it's just so damn cool. One hand gives extremely precise analog control of pitch, yaw, roll, x/y/z translation, plus it's got a heap of buttons. It can emulate a mouse, joystick (direct input), keyboard, or be used directly with it's sdk or raw input messages (I use the latter). All the cheaper models are good too, but the ones without a hand rest are more likely to move around your table when pulling up on the control puck.
Overall... I'm not really sure what to recommend. I've never used SDL's input, I rarely use OIS. Instead I wrote my own input library (it's not available to the public).
Although I'm interested in trying a thing called VRPN which was mentioned twice on this forum recently. It's apparently an input system for virtual reality apps that supports keyboard, mouse, joysticks, 360 controller, 3d connexion, vr gloves, wiimotes, etc. It's got a big list of freaky devices I've never heard of. Could be cool.
-
iblues1976
- Gnome
- Posts: 379
- Joined: Fri Sep 16, 2011 4:54 pm
- x 10
Re: Joystick - Gamepad... general question
@Kojack
It has been extremely helpful for you to point out VRPN. While, I have looked everywhere for different input (or input/output) libraries, I had not run across this one. It would be even nicer if it supported multi-touch screens (or a similar one.)
I really like the the logitech controller (at least the picture...) http://www.amazon.com/gp/product/B0041R ... d_i=507846 but I think I may just go with the Xbox 360 wired controller.
PS: How do you do the url with the name and without the link here in the forum... I always do
It has been extremely helpful for you to point out VRPN. While, I have looked everywhere for different input (or input/output) libraries, I had not run across this one. It would be even nicer if it supported multi-touch screens (or a similar one.)
I really like the the logitech controller (at least the picture...) http://www.amazon.com/gp/product/B0041R ... d_i=507846 but I think I may just go with the Xbox 360 wired controller.
PS: How do you do the url with the name and without the link here in the forum... I always do
Code: Select all
[url]LINKHERE[/url] -
Jabberwocky
- OGRE Moderator

- Posts: 2819
- Joined: Mon Mar 05, 2007 11:17 pm
- Location: Canada
- x 220
Re: Joystick - Gamepad... general question
iblues1976 wrote:PS: How do you do the url with the name and without the link here in the forum... I always do
Code: Select all
[url=http://www.ogre3d.org]This is the ogre website[/url]
-
iblues1976
- Gnome
- Posts: 379
- Joined: Fri Sep 16, 2011 4:54 pm
- x 10
Re: Joystick - Gamepad... general question
with bbcode? inside of url, goes the name... is there [url caption]?
-
Kojack
- OGRE Moderator

- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 538
Re: Joystick - Gamepad... general question
Code: Select all
[url=LINKHERE]Description Here[/url] -
iblues1976
- Gnome
- Posts: 379
- Joined: Fri Sep 16, 2011 4:54 pm
- x 10
Re: Joystick - Gamepad... general question
I found this sample tester in c++ from code project.
http://www.codeproject.com/Articles/269 ... ith-XInput
I just received from amazon, the Logitech gamepad f710, which can be found here
The nice thing about this game pad, is that has a switch for DirectInput and for XInput. So you can choose either one. very nice and it even comes with AA batteries
EDIT:
*****
I'm not so sure about the controller yet. more will be reveal!
****
For my particular project, it is nice that is wireless and the analog joysticks are at the same position. While I love the xbox 360 controller, in my particular case, I think people will feel better using the joysticks at the same level.
Because I will be including this in part of my tutorial, when I'm done, I will set this thread as solved, but anyone is welcome to keep adding info here, if you guys like.
Thanks Kojack for the great info you gave me. I had used xinput before in XNA but you gave me great information!
http://www.codeproject.com/Articles/269 ... ith-XInput
I just received from amazon, the Logitech gamepad f710, which can be found here
The nice thing about this game pad, is that has a switch for DirectInput and for XInput. So you can choose either one. very nice and it even comes with AA batteries
EDIT:
*****
I'm not so sure about the controller yet. more will be reveal!
****
For my particular project, it is nice that is wireless and the analog joysticks are at the same position. While I love the xbox 360 controller, in my particular case, I think people will feel better using the joysticks at the same level.
Because I will be including this in part of my tutorial, when I'm done, I will set this thread as solved, but anyone is welcome to keep adding info here, if you guys like.
Thanks Kojack for the great info you gave me. I had used xinput before in XNA but you gave me great information!
-
Kojack
- OGRE Moderator

- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 538
Re: [SOLVED]Joystick - Gamepad... general question
An xinput / direct input mode switch? That's pretty cool.
-
iblues1976
- Gnome
- Posts: 379
- Joined: Fri Sep 16, 2011 4:54 pm
- x 10
Re: [SOLVED]Joystick - Gamepad... general question
@Kojack
It is nice to have that switch... however as of now, I'm using Xinput only for my app.
I have posted a thread of the analog values of the gamepad in "Back to basics"
Analog Values but I will post the code here that I'm going to use to get rid off of the "dead zone"
I also posted in logitech, but no response Forum Logitech
Anyways, The code I will use to get rid off the "dead zone" is this
I will change the literal 800 for a variable later... I probably should have a calibrator for my app... since I'm using the Advanced Framework from the Ogre Depth tutorials, it is easy just to add another state (with another button) just for that... of course, maybe the easiest thing for me, it would be to create a c# program that calibrates and writes the values in a file. but that would be the boring way.... it would be nice to have a "joystick" image with buttons in a gui inside of my ogre app (in another state) to calibrate... it would be nice and a nice contribution...
Anyways, another step closer to have everything that I need to write my first tutorial...
What I will be moving next is either to use bullet or minimal ogre collision to add it for navigation...
thanks!
It is nice to have that switch... however as of now, I'm using Xinput only for my app.
I have posted a thread of the analog values of the gamepad in "Back to basics"
Analog Values but I will post the code here that I'm going to use to get rid off of the "dead zone"
I also posted in logitech, but no response Forum Logitech
Anyways, The code I will use to get rid off the "dead zone" is this
Code: Select all
short leftX = m_pPlayer1->GetState().Gamepad.sThumbLX;
short leftY = m_pPlayer1->GetState().Gamepad.sThumbLY;
short rightX = m_pPlayer1->GetState().Gamepad.sThumbRX;
short rightY = m_pPlayer1->GetState().Gamepad.sThumbRY;
if (std::abs(leftX) > 800)
{
m_TranslateVector.x = m_MoveScale * (float)leftX * 0.001;
fprintf(stderr, "LX=: %d\n", leftX);
}
if (std::abs(leftY) > 800)
{
m_TranslateVector.z = m_MoveScale * (float)leftY * 0.001;
fprintf(stderr, "LY=: %d\n", leftY);
}
Anyways, another step closer to have everything that I need to write my first tutorial...
What I will be moving next is either to use bullet or minimal ogre collision to add it for navigation...
thanks!
-
iblues1976
- Gnome
- Posts: 379
- Joined: Fri Sep 16, 2011 4:54 pm
- x 10
Re: [SOLVED]Joystick - Gamepad... general question
There are already constant in XInput.h . The logitech has a small dead zone, but I think is safe to use the values in xInput.h
Code: Select all
#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30