OIS Integration Tutorial

A forum to store posts deemed exceptionally wise and useful
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

OIS Integration Tutorial

Post by pc0de »

OIS (Object oriented Input System) is an alternative 3rd party input processing library.

The initial draft of Integrating OIS with Irrlicht is now available on the Irrlicht Engine Wiki.

Thanks go to hybrid for implementing the necessary Irrlicht changes which allow OIS and Irrlicht to work properly on Linux.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Wow, this is a great tutorial, thanks for sharing :)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Great, thanks to both of you for making this happen.
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, it was a good/fun experience for me on several fronts.
Pazystamo
Posts: 115
Joined: Sat Dec 03, 2005 5:56 pm
Location: Lithuania
Contact:

Post by Pazystamo »

hi, i am trying to compile sample program from this tutorial, but i get errors... Using irrlicht 1.4.2 on windows. What shoud i include that it compile?
irrlicht lib
ois lib
irrlicht include
ois include
anything else?
My project in forum- ATMOsphere - new dynamic sky dome for Irrlicht
ecsos
Posts: 30
Joined: Mon Feb 04, 2008 8:02 am

Post by ecsos »

You shouldn't need to do anything on visual studio except:

- use the files on the wiki page ( COIS.h, COIS.cpp, main.cpp )
- link to irrlicht.lib and OIS_static.lib (which you have already compiled separately )


..also, if you are using vs express i don't know you might have a problem including windows.h? in that case find the windows platform sdk to install
Pazystamo
Posts: 115
Joined: Sat Dec 03, 2005 5:56 pm
Location: Lithuania
Contact:

Post by Pazystamo »

I use codeblock with gcc. In COIS.h is #include "OIS.h" so i must include ../ois/includes or else it cant find it. But then i get errors like D:\ois\src\win32\Win32InputManager.cpp|78|undefined reference to `IID_IDirectInput8A'|
D:\ois\src\win32\Win32InputManager.cpp|78|undefined reference to `DirectInput8Create@20'|

Including dx sdk cant fix it..
My project in forum- ATMOsphere - new dynamic sky dome for Irrlicht
Pazystamo
Posts: 115
Joined: Sat Dec 03, 2005 5:56 pm
Location: Lithuania
Contact:

Post by Pazystamo »

OK, finally i compiled, but now then i move any joystick axis program crashes... with other joystick program crashes instantly on load. Is this OIS bug or wrapper?
Edit: program crashes in bool COIS::axisMoved then calling arg.state.mAxes[axis].abs
My project in forum- ATMOsphere - new dynamic sky dome for Irrlicht
ecsos
Posts: 30
Joined: Mon Feb 04, 2008 8:02 am

Post by ecsos »

the printf statement is crashing because it's trying to print an int with a string (%s)...
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

Post by pc0de »

Thanks for the heads up fellas. I've made the necessary corrections to COIS.cpp.
Pazystamo
Posts: 115
Joined: Sat Dec 03, 2005 5:56 pm
Location: Lithuania
Contact:

Post by Pazystamo »

Thanks, it was so easy, but i searched deeper. Started looking mistake in OIS files :)
My project in forum- ATMOsphere - new dynamic sky dome for Irrlicht
MasterM
Posts: 128
Joined: Sat Oct 20, 2007 2:38 am
Location: netherlands antilles, Curacao

Post by MasterM »

On the wiki it says
OIS provides both a Visual Studio solution file and a CodeBlocks (mingw) project for building static libraries on Windows. To build using Visual Studio, open the solution file located in the directory "Win32" off of the OIS installation directory {OIS Install}.
But it only says for visual studio...how about code::blocks?

and when i try to run DemoFFTest.cbp in codeblocks and build it i get a error saying :"ld.exe||cannot find -lOIS_static_d|"
does anyone kow why i am gettign this error?, thanks in advance.
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

Post by pc0de »

MasterM - I see that pjcast responded to your question in the OIS forum.

Note that when I try to build the OIS static libraries using CB, the compiler throws: "dinput.h No such file or directory". So you'll need to modify the project file to point to the proper location.

I'll have a look at adding an example of Win32 Force Feedback to COIS.
Pazystamo
Posts: 115
Joined: Sat Dec 03, 2005 5:56 pm
Location: Lithuania
Contact:

Post by Pazystamo »

I use code::blocks with ois. In newest ois missing one file, you need to include ois/src/OISException.cpp to project (project->add file) and you need DX SDK.
In project build options select OIS and include in search directories:
C:\Program Files (x86)\Microsoft DirectX SDK (August 2008)\Include
..\includes\win32
..\includes\
then select OIS_DebugDll and in linker settings add dinput8.lib and dxguid.lib from DX SDK. Do same with OIS_ReleaseDll.

P.S. Now just need to add 2 or more joystick support (then printing joystick events):)
My project in forum- ATMOsphere - new dynamic sky dome for Irrlicht
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

Post by pc0de »

Added a section in the wiki on Force Feedback. Also updated the sample code:
  • -Dump OIS events to GUI listboxes.
    -Creates and plays a Constant Effect initiated by the "F" Key or Joystick button 7.
    -Control the effect Magnitude with a GUI scrollbar.
Post Reply