http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=19048
Which provided most of what I needed to get started. So I decided to write up what I did so that I would remember for next time, and possibly to help other people out a little. I've only tested this for keyboard input, obviously SDL is a whole other can of worms I don't want to go into right now, but it should provide what you need to at least use input from sources like joysticks that Irrlicht has trouble with. Anyway, this involves compiling Irrlicht with the built-in SDL option enabled, and a little bit of other finicky stuff which I'll explain. This is the first time I've ever written something like this, so please feel free to ridicule and flame me over and over again.
Download Irrlicht with this command:
Code: Select all
svn co https://irrlicht.svn.sourceforge.net/svnroot/irrlicht/branches/releases/1.4 irrlicht
Code: Select all
svn co https://irrlicht.svn.sourceforge.net/svnroot/irrlicht/trunk irrlicht
Then open "irrlicht/source/Irrlicht/Makefile" in your favorite text editor, and find the line that says:
Code: Select all
CPPFLAGS = $(CXXINCS) -DIRRLICHT_EXPORTS=1
Code: Select all
CPPFLAGS = $(CXXINCS) -DIRRLICHT_EXPORTS=1 -D_IRR_USE_SDL_DEVICE_
Before you can compile you need to add a few lines of code to another file. At the very beginning of "irrlicht/source/Irrlicht/COpenGLExtensionHandler.cpp", add these three lines of code:
Code: Select all
#ifdef _IRR_USE_SDL_DEVICE_
#include <SDL/SDL_video.h>
#endif
Now compile Irrlict from scratch, probably like this:
Code: Select all
make NDEBUG=1
That should produce a working copy of Irrlicht compiled to automatically use SDL. A few things are different in Irrlicht with the SDL version, possibly some bugs, although I don't really know. For starters, the mouse cursor is no longer trapped inside the window. This is relatively minor for me, since I usually leave the mouse cursor visible anyway. There is a larger problem which I'm not really sure about however, and that is the fact that Irrlicht thinks its rendering window is inactive until the mouse cursor gets placed on top of it. To avoid this, I stopped checking if the window was active before rendering. It works, but might not in all situations. I think it might be a bad idea, but I'll use that method anyway for now because it seems to work.
To compile programs for SDL/Irrlicht you will need to include the SDL library and header directories. To do that you'll have to add this to either the CPPFLAGS in your makefile, or if you compile your source code by hand with g++, just add it to the g++ command:
Code: Select all
-I/usr/include/SDL -lSDL
The only thing I've tried like this so far is a simple implementation of SDL input in the Quake 3 Map sample program, which I compressed and uploaded just in case you want to take a look at it.
Quake3MapChanges.zip