英文:
Golang crossplatform game engine using mobile pkg?
问题
使用Go移动包资源创建跨平台(移动+桌面)游戏引擎是否可能?还是它与gomobile和移动架构有某种联系?
第一个问题是,我将使用的glsprite和其他渲染包是构建在OpenGL ES之上的,所以我将不得不忽略所有gl
相关的内容,只使用更通用的包,比如https://godoc.org/golang.org/x/mobile/exp/sprite/portable?或者在针对移动平台时仍然可以无缝地使用glsprite?
从理论上讲,音频应该可以通过https://godoc.org/golang.org/x/mobile/exp/audio进行交叉编译,对吗?
这可行吗?还是太麻烦了?
英文:
Is it possible to create a crossplatform (mobile + destkop) game engine using the Go mobile package resources? Or it is somehow tied to gomobile and mobile architectures?
The first problem is the fact that glsprite and other rendering packages I would be using are built on top of OpenGL ES, so I would have to ignore everything that is gl
and use only more generic packages like https://godoc.org/golang.org/x/mobile/exp/sprite/portable? Or I could still use glsprite near-seamlessly when targeting mobile?
Theorically audio should cross-compile fine with https://godoc.org/golang.org/x/mobile/exp/audio?
Is it doable/viable? Or too much hassle?
答案1
得分: 2
上次我在Windows上尝试使用gomobile opengl时,它没有起作用。我只能编译为Android。也许这个bug现在已经修复了,不太确定。
然而,对于跨平台,你可以简单地在移动平台上使用gomobile,并为桌面上的通用opengl创建一个接口,这样你就可以无缝地同时拥有两者。只需将常规opengl和gomobile opengl es之间的接口抽象出来。
更新:
实际上,我刚刚尝试使用go run运行了“basic”示例,在Windows上可以工作。所以这个bug肯定已经修复了。所以在你的回答中,是的,可以使用gomobile x实现跨平台移动端和桌面端:
https://github.com/golang/mobile/blob/master/example/basic/main.go
然而,由于Linux特定的Open AL库,音频在Windows上无法编译。如果你查看构建标志,只有darwin和linux,没有windows。
英文:
Last time i tried gomobile opengl on windows, it didnt work. I was only able to compile for android. Maybe this bug is fixed now, not sure..
However; for cross platform you could simply use gomobile for mobile platforms and create an interface for generic opengl on desktop and you would seamlessly have both. Just abstract out the interface between regular opengl and gomobile opengl es.
update:
actually just tried to run the "basic" example using go run and it worked on windows. So the bug must of been fixed. So in your response, yes it is possible to use go mobile x for cross platform mobile + desktop:
https://github.com/golang/mobile/blob/master/example/basic/main.go
However; audio does NOT compile on windows due to linux specific Open AL libraries. If you look at the build flags, darwin, linux only, no windows.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论