Tuesday, March 11, 2008

SVN r51/r52/r54: The Main (Joystick) Event

Okay. This one's sort of a doozy, so bear with me.

Up until r51, there was a functional difference between joystick and keyboard events. Joystick posted events to Player, which crafted Irrlicht events as necessary and made the system run. This would be all well and fine, if we wanted to use gamepads as keyboards. However, our goal is quite the opposite: We want the gamepads to be our main input devices, with the keyboard as a fallback and debugging tool.

So, here's the basics. Player should be a lightweight class. Joystick will generate events as necessary, using StateManager to determine when keyboard events should be synthesized in addition to joystick events. The struct JoystickEvent will be used to pass around joystick events. Joystick and JoystickManager will become smarter, and Player will become dumber. This is the plan.

r51 and r52 put down stubs and the initial code move from Player to Joystick. r54 simplifies the code, since being in Joystick means that less Joystick-specific information needs to be passed around.

TODO: Test this stuff. I haven't been able to test it yet. Also test OpenAL on Windows and get Irrlicht to use vsync on Linux.

~ C.

No comments: