OIS Integration Tutorial

A forum to store posts deemed exceptionally wise and useful
Magus_Stragus
Posts: 86
Joined: Wed Aug 29, 2007 10:45 pm

Post by Magus_Stragus »

Hey there. I'm trying to use the guide provided in the tutorial, but I have a small problem. I'm using Eclipse under Linux, and when I try to compile, I get the following error:

Severity and Description Path Resource Location Creation Time Id
error: ‘struct irr::SIrrlichtCreationParameters’ has no member named ‘IgnoreInput’ Oistest main.cpp line 429 1229576118430 1328

Generated by the lines of code:

Code: Select all

#if defined(_IRR_LINUX_PLATFORM_) && defined(_IRR_USE_LINUX_DEVICE_)
    cp.IgnoreInput = true;
#endif
I tried using both 1.4 and 1.4.2 versions, and I got the same error with them. So, what am I doing wrong?
Proud member of the Online Campaign for Real English. If you believe in capital letters, correct spelling and good sentence structure then copy this into your signature.
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

Post by pc0de »

If I remember correctly, IgnoreInput was added between 1.4.1 & 1.4.2.

Open "SIrrCreationParameters.h" located in the Irrlicht include directory and verify that "IgnoreInput" exists in that file.

If it does, then you need to be certain that specific version of SIrrCreationParameters.h is being included in your build.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Maybe it was added at that time, but it only exists in Irrlicht 1.5 :!:
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

Post by pc0de »

Ah, okay I'll update the wiki with that requirement. Thanks.
Magus_Stragus
Posts: 86
Joined: Wed Aug 29, 2007 10:45 pm

Post by Magus_Stragus »

It worked with Irrlicht 1.5, but now, I have another problem. I run the program, but the Joystick isn't being recognized. I also was checking the code, and I can't find where the "direction" of the joystick is stated. I mean, in other applications I have used, I had to state where the Joystick event handler was (like adding the argument "/dev/input/js0" in the command line, for example). Does OIS locate automatically the joystick device? Or that's the reason why the program isn't recognizing my joystick?
Proud member of the Online Campaign for Real English. If you believe in capital letters, correct spelling and good sentence structure then copy this into your signature.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Magus_Stragus wrote:I run the program, but the Joystick isn't being recognized. I also was checking the code, and I can't find where the "direction" of the joystick is stated. I mean, in other applications I have used, I had to state where the Joystick event handler was (like adding the argument "/dev/input/js0" in the command line, for example).
Great, thanks for reporting this. Lunix, right?

CIrrDeviceLinux::activateJoysticks()

We check:
/dev/jsX
/dev/input/jsX

Where 0 <= X < 31. On my Ubuntu 8.10 insteall, I'm finding the joystick a /dev/input/js0. If you're having problems, then any information that you can provide about where your joystick device actually is would be great.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Magus_Stragus
Posts: 86
Joined: Wed Aug 29, 2007 10:45 pm

Post by Magus_Stragus »

Wait, wait, how do I use that?

I tried to put it in the main(), but it gives me errors.

And yes, the joystick is in /dev/input/js0.
Proud member of the Online Campaign for Real English. If you believe in capital letters, correct spelling and good sentence structure then copy this into your signature.
Magus_Stragus
Posts: 86
Joined: Wed Aug 29, 2007 10:45 pm

Post by Magus_Stragus »

This is, to be more specific about what I'm doing wrong, how do I pass the parameters of it?

activateJoysticks (core::array< SJoystickInfo > &joystickInfo)=0

What is the core::array< SJoystickInfo > &joystickInfo?
Proud member of the Online Campaign for Real English. If you believe in capital letters, correct spelling and good sentence structure then copy this into your signature.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

I'm not sure that I understand the question. Is the code in example 19 unclear?

Code: Select all

	core::array<SJoystickInfo> joystickInfo;
	if(device->activateJoysticks(joystickInfo))
	{
		std::cout << "Joystick support is enabled and " << joystickInfo.size() << " joystick(s) are present." << std::endl;

		for(u32 joystick = 0; joystick < joystickInfo.size(); ++joystick)
		{

			// and so on
Is that causing you problems with you try something similar in your app? If so, can you please be specific about the problems that you are experiencing.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Magus_Stragus
Posts: 86
Joined: Wed Aug 29, 2007 10:45 pm

Post by Magus_Stragus »

Ah, I didn't know there was a tutorial for that. As I am used to version 1.4, I didn't know about it.

But still, after I do that, it says me that joystick support is enable, but that there are no joysticks. Why is this happening!? T_T
Proud member of the Online Campaign for Real English. If you believe in capital letters, correct spelling and good sentence structure then copy this into your signature.
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

Post by pc0de »

Maybe I'm confused again - damn Mad cow...

Magus_Stragus, are you trying to access the Joystick via OIS or using the Irrlicht Joystick API?

Assuming OIS - OIS doesn't use either /dev/jsX or /dev/input/jsX. Instead it uses /dev/input/eventX. The reason is in this forum post: "ubuntu: joystick working but not detected by ois".

I'm using Ubuntu, which by default only allows root access to /dev/input/eventX. Therefore in order to gain access in Ubuntu I:
  • 1. Created a "games" group.

    2. Created a new file (udev rule) named /etc/udev/rules.d/50-joystick.rules containing:

    Code: Select all

    KERNEL=="event*", GROUP="games", MODE="0660"
Magus_Stragus
Posts: 86
Joined: Wed Aug 29, 2007 10:45 pm

Post by Magus_Stragus »

Though that method didn't work, you are right regarding the permissions. As I couldn't find a way to run as superuser through Eclipse, I had to compile everything on the console. Well, now the application recognizes the joystick, but it isn't reading the events, nor the force feedback support... -_-U Lucky me...

Any roads, any help regarding this? I wanted to try this on Windows, but for some reason I can't get to compile OIS (I tried Code::Blocks and VC++, but there were certain errors that didn't allow me to compile it.)
Proud member of the Online Campaign for Real English. If you believe in capital letters, correct spelling and good sentence structure then copy this into your signature.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Durrr, sorry, I completely missed that you were having a problem with OIS joystick handling. I thought that you were reporting a bug in Irrlicht 1.5's joystick handling that you weren't seeing in OIS. :oops:
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

Post by pc0de »

No problem rogerborg, I took the pill anyway.

Magus_Stragus - Linux questions:
  • 1. Which Linux distribution are you using?
    2. Did you add your account to the "games" group?
    3. What are the permissions set to on all /dev/input/eventX?
    4. If your Joystick is USB, are the permissions changing when you plug it in?
Also, what errors are you getting when you try to compile on Windows?
Last edited by pc0de on Sun Dec 21, 2008 7:17 am, edited 1 time in total.
Magus_Stragus
Posts: 86
Joined: Wed Aug 29, 2007 10:45 pm

Post by Magus_Stragus »

First, I can't use it on Windows, due to my inability to compile OIS. So I have to use Ubuntu 8.04. I did add the group games, and I did add my account as part of that group, and added the joystick rule also. And that didn't work (it still didn't recognized me the joystick). So, I compile it on the console, using sudo to run it, and it recognized me the joystick, but it didn't read me any input event, nor it recognized me the force feedback (which I'm pretty sure I have it, as I tested it with some other code).

So, what am I doing wrong?
Proud member of the Online Campaign for Real English. If you believe in capital letters, correct spelling and good sentence structure then copy this into your signature.
Post Reply