{"id":944,"date":"2009-10-30T22:28:01","date_gmt":"2009-10-30T11:28:01","guid":{"rendered":"http:\/\/www.vectorstorm.org\/?p=944"},"modified":"2009-10-30T22:28:01","modified_gmt":"2009-10-30T11:28:01","slug":"the-fun-of-input-devices","status":"publish","type":"post","link":"https:\/\/www.vectorstorm.com.au\/2009\/10\/30\/the-fun-of-input-devices\/","title":{"rendered":"The fun of input devices"},"content":{"rendered":"
So I’ve been looking around at various input devices again, and pondering about how VectorStorm might support them. \u00a0Tablets and styluses and light guns are, of course, easy, as from software’s point of view, they’re basically just mice which have cursors which ought to vanish when their buttons aren’t being held down.. \u00a0the VectorStorm engine can handle these quite easily right now.<\/p>\n
Multitouch surfaces (such as many modern laptop trackpads, iPhones, and other devices) are a little more tricky; \u00a0one could argue that they’re just multiples of the tablet “vanishing mouse”; \u00a0instead of one cursor that behaves that way, you have three or four of them. \u00a0Unfortunately, none of them are actually implemented that way in the OS, and the current version of SDL which I use doesn’t support these types of devices. \u00a0Well.. my MacBook Pro’s trackpad has a “two-finger-scrollwheel” feature which works in VectorStorm games, but only because it’s being treated as a scrollwheel.<\/p>\n
Speaking of scroll wheels, it’s worth mentioning that under Windows and Linux, scroll wheels act like buttons. \u00a0They have integer “clicks”, and\u00a0send a “button down” event every time they’re spun a distance of one “click”, however that’s defined for the particular mouse. \u00a0You can’t scroll by a half-click; \u00a0if you had a mouse which didn’t have ‘stops’ on it, and you spun the wheel by half of a ‘click’ (however far that is on that mouse), you’d get no scrolling at all. \u00a0By contrast, under Mac OS X, scroll wheels typically have no ‘stops’, and report a floating point distance. \u00a0The VectorStorm engine treats a scroll wheel as a digital button — that is, the extra precision available under OS X is lost. \u00a0Or to be more specific, SDL swallows that extra precision, and never shows it to VectorStorm in the first place. \u00a0Similarly, the current version of SDL does not support horizontal scroll wheels at all, either on the rare Windows mice equipped with them, or Apple’s “scroll ball” on the Mighty Mouse or two-finger scrolling on trackpads or touch-scrolling on the Magic Mouse. \u00a0SDL does<\/em> support tilt wheels, which while still somewhat unusual, are no longer considered exotic under Windows. \u00a0On tilt wheels, the left and right tilting of the wheel shows up as two extra mouse buttons, and so can easily be mapped to functions inside VectorStorm. \u00a0I imagine that proper support for horizontal scrolling is probably going to require a new version of SDL, and even then, it probably won’t support full-resolution scrolling \u00a0under OS X. \u00a0And even if full-resolution scrolling was supported for OS X, I couldn’t actually use it for anything important, as Windows and Linux users wouldn’t have access to it, as it’s not provided at an OS level for them.<\/p>\n Most popular custom controllers like Guitar Hero guitars and Dance Dance Revolution mats are easy to support; \u00a0they’re just joysticks without the sticks. \u00a0If you can get your OS to detect them as gamepads, VectorStorm should be able to make use of them.<\/p>\n Gesture controls are, of course, big business these days, and every platform does them slightly differently. \u00a0But when you come right down to it, gesture controls are the first big thing that really doesn’t fit well into the VectorStorm input model. \u00a0Oh, sure, I briefly ported VectorPhysics (from the testbed apps) over to the iPhone, and used the accelerometer to set the gravity for the simulation. \u00a0But I couldn’t use SDL to get at the data, and passing the data through the sysInput interface was a real kludge; \u00a0sysInput is designed to handle one-dimensional data. \u00a0Passing matrices and 3D vectors through it was just awkward and unpleasant. \u00a0I don’t expect to see SDL providing support for these any time soon.<\/p>\n