A feature request

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

A feature request

Post by 3DModelerMan »

It would be great if the event receiver supported joysticks and other input devices, instead of just the keyboard. :D
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

Have you tried the mouse?
Image
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

There has been talk about re-doing the input system to make it more extensible. But while your waiting, why not have a go at trying to fix it yourself?
TheQuestion = 2B || !2B
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Post by kornwaretm »

while i waiting
since i lack of skill
i use SDL
and i pray so hard
:lol:
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

yeah

Post by 3DModelerMan »

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
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

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!
Image Image Image
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

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?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

There's also the question which joystick is queried, or do we want to query all found, ... I guess the I/O system needs some general flexibility added, or otherwise it will become quite clumsy. However, I'd also like to add multi-touch in some way, sometimes 8)
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

ummm

Post by 3DModelerMan »

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).
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

hybrid wrote:There's also the question which joystick is queried, or do we want to query all found,
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.

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
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Full patch dumped in the tracker.

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
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Well, I'm having fun with it. :P
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

hmmm

Post by 3DModelerMan »

How did you get the joystick buttons?.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Re: hmmm

Post by rogerborg »

3DModelerMan wrote:How did you get the joystick buttons?.
They came free with the joystick.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

nothing's ever free rogerborg... clearly the price of the joystick included the cost of the buttons as well!
Image Image Image
Post Reply