检查键盘状态

huangapple go评论146阅读模式
英文:

Checking keyboard state

问题

我似乎找不到一个支持检查键盘状态的Go跨平台库。

我不想使用像Qt这样沉重的库,因为它很难进行交叉编译,而且GUI元素非常简单。如果有人能指点我正确的方向,那就太棒了。

非常感谢。

我尝试过的东西:

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

https://github.com/gotk3/gotk3

https://github.com/andlabs/ui(到目前为止我最喜欢的,非常轻量级。)
如果有其他可以与这个一起使用的东西,那就太好了。

编辑:

嘿,大家好,几个月后我想给个更新。最终我选择了Qt。TheRecipe的绑定相当可靠,除了一些bug之外。简而言之,获取正确的键盘输入只是一件非常痛苦的事情。

英文:

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

得分: 1

我发现GLFW的设置非常简单。
https://github.com/go-gl/glfw

如果你想要更跨平台的东西,可以试试
https://github.com/goxjs/glfw

它具有条件编译功能,可以在桌面平台上正常编译,也可以在gopherjs上运行相同的代码,以在浏览器画布中运行。

这是我用它制作的一个键盘处理程序包:
https://github.com/Omustardo/gome/blob/master/input/keyboard/keyboard.go

英文:

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

huangapple
  • 本文由 发表于 2017年2月25日 12:34:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/42451992.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定