A feature request
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
A feature request
It would be great if the event receiver supported joysticks and other input devices, instead of just the keyboard.
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
-
- Competition winner
- Posts: 189
- Joined: Tue Oct 16, 2007 3:53 am
- Location: Indonesia
- Contact:
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
yeah
I use a seperate lib for joysticks to, but I thought it would be great to have something in irrlicht.
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
It's an unlikely addition i would say. Sure it would be useful for game makers but irrlicht is just a rendering engine which means joysticks mean nothing to it. It provides a simple and basic way of receiving input from the standard input devices of a PC and that's all it really needs. Other libs out there such as SDL do the job just fine by the sounds of it so adding it into irrlicht would be a bit unecessary and there's more important features to be focused on!
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
This is actually is a reasonable suggestion. The winmm joystick support is probably good enough for most purposes, and I'm sure that Lunix and WhackOS have similar APIs. Adding new Irrlicht events for joystick inputs won't be a huge task.
The one Thompson in the ointment is that joystick axes inputs are pollable state based inputs, rather than event based. That said, we could probably poll the inputs and send axes events once per tick without the world ending.
"All" we need to do is find someone with the time to implement this (the new events, and at least one native platform) and add some test cases. Is anyone else up for it, or have I found my weekend project?
The one Thompson in the ointment is that joystick axes inputs are pollable state based inputs, rather than event based. That said, we could probably poll the inputs and send axes events once per tick without the world ending.
"All" we need to do is find someone with the time to implement this (the new events, and at least one native platform) and add some test cases. Is anyone else up for it, or have I found my weekend project?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
ummm
I have no idea how to program it but I still think it would be cool.
And what about if you had feedback mechanisms (rumble etc).
And what about if you had feedback mechanisms (rumble etc).
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
I'd imagine that we'd enumerate and then poll them all, since the user app can ignore any events for devices that it doesn't care about, just as it can currently ignore keyboard or mouse events.hybrid wrote:There's also the question which joystick is queried, or do we want to query all found,
Feedback is probably a bridge too far for an Irrlicht feature. I don't see a neat way to do it without adding a new input device API module, and there are plenty of good 3rd party solutions for that already.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Full patch dumped in the tracker.
How does this look for a joystick info event?
How does this look for a joystick info event?
Code: Select all
//! A joystick event. Unlike other events, joystick events represent
//! the result of polling each connected joystick once per run() of the device.
//! An event of this type will be generated once per joystick per run()
//! regardless of whether the state of the joystick has actually changed.
struct SJoystickEvent
{
enum
{
NUMBER_OF_BUTTONS = 32,
AXIS_X = 0, // e.g. analog stick 1 left to right
AXIS_Y, // e.g. analog stick 1 top to bottom
AXIS_Z, // e.g. throttle, or analog 2 stick 2 left to right
AXIS_R, // e.g. rudder, or analog 2 stick 2 top to bottom
AXIS_U,
AXIS_V,
NUMBER_OF_AXES
};
//! A bitmap of button states. You can use IsButtonPressed() to
//! check the state of each button from 0 to (NUMBER_OF_BUTTONS - 1)
u32 ButtonStates;
//! For AXIS_X, AXIS_Y, AXIS_Z, AXIS_R, AXIS_U and AXIS_V
//! Values are in the range 0 - 65535, with 32767 representing
//! the center position. You will usually want to add a dead
//! zone around this center range. Axes not supported by this
//! joystick will always have a value of 32767.
u16 Axis[NUMBER_OF_AXES];
//! The POV represents the angle of the POV hat in degrees * 100,
//! from 0 to 35,900. A value of 65535 indicates that the POV hat
//! is centered (or not present).
u16 POV;
//! The ID of the joystick which generated this event.
u8 Joystick;
bool IsButtonPressed(u32 button) const
{
if(button >= 32)
return false;
return (ButtonStates & (1 << button)) ? true : false;
}
};
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Well, I'm having fun with it.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
hmmm
How did you get the joystick buttons?.
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Re: hmmm
They came free with the joystick.3DModelerMan wrote:How did you get the joystick buttons?.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way