|
From: Thomas B. <bo...@bo...> - 2004-03-26 16:23:59
|
You can find my code for supporting multiple USB trackballs as Atari 2600 paddles in Stella here: http://www.boutell.com/boutell/trackballs.tar.gz This contains mouse.cxx and mouse.hxx, which actually implement the trackball support, and my copy of mainSDL.cxx. I apologize for not posting mainSDL.cxx as a proper patch, but everything is wrapped in "#if FOUR_TRACKBALL_PADDLES", so you really can't miss it. Except that I see I inadvertently forgot to wrap the setting of playfieldWidth and playfieldHeight in an #if. Whoops. An important issue to be aware of: there's a block of code wrapped in '#if PADDLE_ORIENTATION' in mouse.cxx. This is a hack to allow for players seated at four sides of a table, and it's not complete, either -- I should be reorienting two of the players, not just one, and I should allow the orientation flips to be determined by a configuration file, et cetera, et cetera. But for a conventional Atari 2600 experience, which would be four players sitting side by side in front of the "TV set," you don't need this orientation stuff at all, so I suggest you just dump it unless you're keenly interested in the cocktail-style-game-table orientation support idea. Of course, most likely you'll just use my code as a source of ideas. See mouseSetup and mousePoll, ignore my #ifdeffed-out SDL main loop in mousePoll (in some of my own games the SDL main loop does live here), and be sure to check out the code under the comment "direct linux mouse reads," which does the real work. All you have to do is call mouseSetup initially and call mousePoll from handleEvents, and you've got data to work with. Warlords plays great with four Logitech USB trackballs, which are typically $10-$15 each on ebay, new in shrinkwrap. Just one more note: in a typical setup -- unlike my game table -- one of the /dev/input/mouseX devices will actually be in use by the X server. You should tolerate this situation gracefully by just not mapping that particular device to a paddle. In fact, you should probably enable both your existing "one X11 mouse as paddle" code, for paddle one, and my "linux mice as paddles" code, for the remaining paddles. That's about it! Let me know if you have any questions. -- Thomas Boutell Boutell.Com, Inc. http://www.boutell.com/ Sync my card with your PDA or address book: http://tocard.biz/a7oiljb6 |