dshun123456 2017-02-25 04:34
浏览 9
已采纳

检查键盘状态

I can't seem to find a cross-platform library with Go that supports checking the state of the keyboard.

I'd rather not use something so heavy as Qt as it makes it quite hard to cross-compile and the GUI elements are very simple. If anybody could point me in the right direction, that would be amazing.

Thanks a ton.

Stuff I've tried:

https://mattn.github.io/go-gtk/

https://github.com/gotk3/gotk3

https://github.com/andlabs/ui (My favorite thus far, very lightweight.) If there is something I could use alongside this, that would be great as well.

EDIT:

Hey guys, a few months later just wanted to give an update. I ended up going the Qt route. Therecipe's bindings are pretty solid, aside from a few bugs. Getting proper keyboard input to put it short was nothing more than a pain in the ass.

  • 写回答

1条回答 默认 最新

  • dongshao4207 2017-02-25 05:20
    关注

    I found GLFW to be pretty straightforward to get set up. https://github.com/go-gl/glfw

    If you want something even more cross platform, try out https://github.com/goxjs/glfw

    It has conditional compilation which lets you compile on desktop platforms normally, but also to gopherjs so you can run the same code in a browser canvas.

    Here a keyboard handler package I made with it: https://github.com/Omustardo/gome/blob/master/input/keyboard/keyboard.go

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3