Ah, just noticed the Mac part... https://github.com/glfw/glfw/blob/master/src/cocoa_joystick.m
Also Chromium source for the Gamepad implementation: https://cs.chromium.org/chromium/src/device/gamepad/?q=gamepad&sq=package:chromium&dr Unfortunately I didn't notice a Go gamepad implementation for Mac... however there might be one. On Tuesday, 27 March 2018 15:02:10 UTC+3, Egon wrote: > > Usually controllers don't speak directly to your application nor browser. > > Usually there is a driver that the controller has, this talks with the > appropriate protocol to the device. The driver itself provides some common > HID api that the OS has specified. > > The reading and writing the input is effectively about communicating with > the OS. > > https://github.com/glfw/glfw/blob/master/src/linux_joystick.c > https://github.com/glfw/glfw/blob/master/src/win32_joystick.c > > You can do those calls using syscall package, e.g. one for Windows > > https://github.com/egonelbre/exp/blob/master/game/gamepad/xinput_windows.go > > and a quick search on godoc.org revealed this: > https://godoc.org/?q=joystick > https://github.com/simulatedsimian/joystick > > Of course since it's OS specific, you need to implement for all of them. > Where each might their own quirks. > > SDL and GLFW are both thoroughly tested. I'm not sure about the existing > package, but it shouldn't be difficult to switch when you do encounter > problems with the pure Go libs. > > + Egon > > On Tuesday, 27 March 2018 05:19:24 UTC+3, Zellyn wrote: >> >> Inspired by a Wired article >> <https://www.wired.com/story/xbox-one-x-and-xbox-one-deals/> mentioning >> XBox One gamepads for $34, I finally got a game controller. >> >> Naturally, now I'm wondering how to read it from Go :-) >> >> It connects to Mac OS over Bluetooth. Various games seem to vary in >> whether they recognize or even notice it, but it works flawlessly in Chrome >> using http://html5gamepad.com/ >> <http://www.google.com/url?q=http%3A%2F%2Fhtml5gamepad.com%2F&sa=D&sntz=1&usg=AFQjCNHgk2HZ9Nwso2KFkEVEFST54APnmQ> >> >> So, if there's anyone here who even begins to know how gamepads work… am >> I about to wade into an ocean of pain? I'd *like* to avoid linking to >> sdl as gobot seems to do for joysticks: it would be lovely to have >> something in pure Go. Is that unlikely? >> >> How are games (and Chrome) even finding the controller? Do they have to >> interrogate the Bluetooth stack, and then speak both Bluetooth and the XBox >> controller protocol? >> >> Any help appreciated. >> >> Zellyn >> >> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.