gamepad input lib?(solved)
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
no
What I meant was that WXwidgets has WXjoystick in it. I can't find any OIS libraries that are prebuilt, and when I try to compile it, it won't find direct input, do I have to have a direct input SDK?.
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
-
- Posts: 224
- Joined: Tue Oct 25, 2005 4:32 pm
- Location: Louisiana, USA, backwater country
- Contact:
http://irrlicht.sourceforge.net/phpBB2/ ... highlight=
there. that's my 'sdl event receiver with joystick support'
i can assure you all the joystick axis controls work.
i can't assure you on keyboard, mouse, or joy buttons because i haven't had any chances to test them.
there. that's my 'sdl event receiver with joystick support'
i can assure you all the joystick axis controls work.
i can't assure you on keyboard, mouse, or joy buttons because i haven't had any chances to test them.
When banks compete, you win.
When ISPs compete, you win.
When electronics retailers compete, you win.
When governments compete...you get drafted.
When ISPs compete, you win.
When electronics retailers compete, you win.
When governments compete...you get drafted.
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
oh
Thanks! .
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
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
hmmm
I've been doing some research on sourceforge, and I found this
http://qjoypad.sourceforge.net/#features
and this
http://sourceforge.net/projects/glfw/
what do you think of these?.
http://qjoypad.sourceforge.net/#features
and this
http://sourceforge.net/projects/glfw/
what do you think of these?.
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
1: You did research, good for you, that's a nice change in attitude.
2: The first library, QJoyPad is GPL, aka, not compatible with Irrlicht license.
3: The second library seems nice but extremely heavy for the needs of Irrlicht. It'd need to be gutted badly. You're better off starting from Rogerborg's version.
2: The first library, QJoyPad is GPL, aka, not compatible with Irrlicht license.
3: The second library seems nice but extremely heavy for the needs of Irrlicht. It'd need to be gutted badly. You're better off starting from Rogerborg's version.
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
My reaction:Dorth wrote:1: You did research, good for you, that's a nice change in attitude.
And also XWindows only. I thought you were targetting MS Windows?Dorth wrote:2: The first library, QJoyPad is GPL, aka, not compatible with Irrlicht license.
Aw shucks. If you're targetting MS Windows initially, then joystick / joypad is just a handfull of function calls. This is the entire code that I've proposed adding to CIrrDeviceWin32, that enumerates joysticks (once) to find active ones, then polls the active joysticks. It creates an Irrlicht SEvent; if you use similar code in a user app, you don't even need to do that, you can just use the JOYINFOEX values directly.Dorth wrote:3: The second library seems nice but extremely heavy for the needs of Irrlicht. It'd need to be gutted badly. You're better off starting from Rogerborg's version.
Code: Select all
#include <mmsystem.h>
#pragma comment(lib, "winmm.lib")
void CIrrDeviceWin32::initialiseJoysticks()
{
const u32 numberOfJoysticks = ::joyGetNumDevs();
JOYINFOEX info;
info.dwSize = sizeof(info);
info.dwFlags = JOY_RETURNALL;
JoystickInfo activeJoystick;
for(u32 joystick = 0; joystick < numberOfJoysticks; ++joystick)
{
if(JOYERR_NOERROR == joyGetPosEx(joystick, &info)
&&
JOYERR_NOERROR == joyGetDevCaps(joystick,
&activeJoystick.Caps,
sizeof(activeJoystick.Caps)))
{
activeJoystick.Index = joystick;
ActiveJoysticks.push_back(activeJoystick);
}
}
}
void CIrrDeviceWin32::pollJoysticks()
{
if(0 == ActiveJoysticks.size())
return;
u32 joystick;
JOYINFOEX info;
info.dwSize = sizeof(info);
info.dwFlags = JOY_RETURNALL;
for(joystick = 0; joystick < ActiveJoysticks.size(); ++joystick)
{
if(JOYERR_NOERROR == joyGetPosEx(ActiveJoysticks[joystick].Index, &info))
{
SEvent event;
const JOYCAPS & caps = ActiveJoysticks[joystick].Caps;
event.EventType = irr::EET_JOYSTICK_INPUT_EVENT;
event.JoystickEvent.Joystick = joystick;
event.JoystickEvent.POV = (u16)info.dwPOV;
if(event.JoystickEvent.POV > 35900)
event.JoystickEvent.POV = 65535;
for(int axis = 0; axis < SEvent::SJoystickEvent::NUMBER_OF_AXES; ++axis)
event.JoystickEvent.Axis[axis] = 32767;
switch(caps.wNumAxes)
{
default:
case 6:
event.JoystickEvent.Axis[SEvent::SJoystickEvent::AXIS_V] =
(u16)((65535 * (info.dwVpos - caps.wVmin)) / (caps.wVmax - caps.wVmin));
case 5:
event.JoystickEvent.Axis[SEvent::SJoystickEvent::AXIS_U] =
(u16)((65535 * (info.dwUpos - caps.wUmin)) / (caps.wUmax - caps.wUmin));
case 4:
event.JoystickEvent.Axis[SEvent::SJoystickEvent::AXIS_R] =
(u16)((65535 * (info.dwRpos - caps.wRmin)) / (caps.wRmax - caps.wRmin));
case 3:
event.JoystickEvent.Axis[SEvent::SJoystickEvent::AXIS_Z] =
(u16)((65535 * (info.dwZpos - caps.wZmin)) / (caps.wZmax - caps.wZmin));
case 2:
event.JoystickEvent.Axis[SEvent::SJoystickEvent::AXIS_Y] =
(u16)((65535 * (info.dwYpos - caps.wYmin)) / (caps.wYmax - caps.wYmin));
case 1:
event.JoystickEvent.Axis[SEvent::SJoystickEvent::AXIS_X] =
(u16)((65535 * (info.dwXpos - caps.wXmin)) / (caps.wXmax - caps.wXmin));
}
event.JoystickEvent.ButtonStates = info.dwButtons;
(void)postEventFromUser(event);
}
}
}
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
so
So that does joystick axis controls only I noticed from the code, I don't know what I'll do yet, but I'm definitely going to keep an eye on rogerborgs joystick thing for the event receiver, it looks nice, maybe in the meantime I'll do a little more research and check out MSDN's direct input tutorial. And I'm yeah I'm actually doing MSwindows.
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: so
All axes, including 2nd analogue stick / throttle / rudder, and POV hat, and up to 32 buttons. Is there anything commonly available on a joystick / gamepad that's not on that list? WinMM doesn't present force feedback or rumble APIs though. If you want that functionality, I'd recommend just going straight to DirectInput. I haven't used that for years though, so I don't know how easy it is to use in its current state.3DModelerMan wrote:So that does joystick axis controls only
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