Easiest way to read the input from an USB gamepad crossplatform?

xuanbao · 2017-08-01 22:00:04 · 589 次点击    
这是一个分享于 2017-08-01 22:00:04 的资源,其中的信息可能已经有所发展或是发生改变。

Hi,

I would like to know what would be the easyist way to read an USB gamepad with go as input for a little game?

It would be nice if the code would run crossplatform ARM Linux and AMD64 Mac OS..

I know there are lib usb binding like https://github.com/kylelemons/gousb and https://github.com/boombuler/hid

I would like something which is native go and activly maintained ... any recommenditions the whole project is just for learning purposes..


评论:

drunken_thor:

I built mine on top of sdl: https://github.com/tanema/amore/tree/master/joystick 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.

Sythe2o0:

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.

egonelbre:

Depends on what you are going for, but... either SDL, glfw should be quite fine. (You can see a glfw example in Zombies on Ice)

PS: as requested, I'm author of that code.

Sythe2o0:

It might be polite to mention this is a project of yours that you are plugging

egonelbre:

Wasn't intended as a plug, but added a note nevertheless.


入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

589 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传