<p>Hi,</p>
<p>I would like to know what would be the easyist way to read an USB gamepad with go as input for a little game?</p>
<p>It would be nice if the code would run crossplatform ARM Linux and AMD64 Mac OS.. </p>
<p>I know there are lib usb binding like <a href="https://github.com/kylelemons/gousb" rel="nofollow">https://github.com/kylelemons/gousb</a> and <a href="https://github.com/boombuler/hid" rel="nofollow">https://github.com/boombuler/hid</a></p>
<p>I would like something which is native go and activly maintained ... any recommenditions the whole project is just for learning purposes..</p>
<hr/>**评论:**<br/><br/>drunken_thor: <pre><p>I built mine on top of sdl: <a href="https://github.com/tanema/amore/tree/master/joystick" rel="nofollow">https://github.com/tanema/amore/tree/master/joystick</a> I made most packages in my game lib independent so you could theoretically use it by itself but I think you would also need an SDL context running. Not exactly native Go either since it uses cgo for sdl.</p></pre>Sythe2o0: <pre><p>There are no native go usb support libraries, afaik. It should be doable to do a c2go + a lot of work on libusb to create one, but there's a lot of code there to deal with.</p></pre>egonelbre: <pre><p>Depends on what you are going for, but... either SDL, glfw should be quite fine. (You can see a glfw example in <a href="https://github.com/loov/zombies-on-ice/blob/master/input.go" rel="nofollow">Zombies on Ice</a>)</p>
<p>PS: as requested, I'm author of that code.</p></pre>Sythe2o0: <pre><p>It might be polite to mention this is a project of yours that you are plugging</p></pre>egonelbre: <pre><p>Wasn't intended as a plug, but added a note nevertheless.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传