So, on Win32, a set of helper functions are needed in order to track DirectInput. JoystickManager has to track the DirectInput8 interface, and each Joystick has to track a DirectInputDevice8. It's fucking ridiculous. I bet if I counted lines, there would be more DirectInput code than Linux code. Hmm. Lemme check.
$ i686-pc-linux-gnu-g++ -E -I/usr/include/irrlicht joystick.cpp | wc -lL -
58901 235 -
$ mingw32-g++ -E -I/usr/mingw32/usr/include/irrlicht joystick.cpp | wc -lL -
68855 529 -
Wow. The MinGW version, with headers, is almost 10,000 lines more of code. The second number is "number of characters in longest line," which is another staggering comparison: 529 vs. 235 characters.
"But wait," you say, "in your sleep-deprived excitement you forgot that the headers for different compilers are different sizes!"
"Ah, yes," says I, "I did not forget. Let us run the comparison again."
Manually checking the preprocessor output, I find that the Linux version's Joystick class def is at line 58719, while the Win32 version's is at 68675. Thus, the Linux joystick.h/cpp is 182 lines, and Win32 is 180. Too close to call, really. The other file, joystickmanager.h/cpp, is only 30 lines more expensive in Windows than in Linux. (But 30/180 is 1/6, so you could say that it's a 20% increase from Linux to Windows. Ah, the joys of statistics.)
Looks like my hypothesis was wrong. Nonetheless, having to enumerate and calibrate axes manually is a pain in the ass. If you want shits 'n' giggles, take a look at the source code, especially joystick.cpp. Tons of fun in there.
Summary:
- DirectInput handler for joysticks.
- Official Windows 32-bit support.
- Subdivision of Joystick and JoystickManager classes into Windows and Linux parts.
- Undying hate of Microsoft programming interfaces reaffirmed and vindicated.
Also, I haven't actually tried building this on Win32. That's Justin's task. I think. I hope.
See you later.
~C.
No comments:
Post a Comment