适用于 Windows 的带有 OpenGL 和 SDL 预编译发行版的 Haskell 或 Ocaml
我想学习 Ocaml 或 Haskell,并且我想通过编写一个简单的游戏来实现。显然,有一个小问题:没有人关心 Windows,而我想在 Windows 上本地实现这一点。
Haskell 有 Cabal,它有 SDL,但由于没有解决方法的小问题(传递给 gcc 的参数顺序)而无法构建。 Ocaml 甚至没有这个,它都在源代码包中,无论是 GLCaml 还是 OcamlSDL 或者其他什么。
有没有一个地方可以让我在 Windows 上获得适用于 Haskell 或 Ocaml 的 SDL,而无需与十几个版本的编译器作斗争?
I want to learn Ocaml or Haskell and I want to do it by writing a simple game. Apparently, there's one small problem: nobody cares about Windows and I want to do it on Windows, natively.
Haskell has Cabal, which has SDL, but it doesn't build due to a trivial problem with no workarounds (order of parameters passed to gcc). Ocaml doesn't even have that, it's all in source packages, be it GLCaml or OcamlSDL or whatever.
Is there a place where I can get a working SDL for Haskell or Ocaml on Windows without fighting with a dozen versions of compilers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Haskell 平台附带了与 OpenGL 的绑定,它应该可以在 Windows 上开箱即用。
关于 hackage 上的 SDL 包,您可以使用
cabal unpack SDL
获取源代码并自行修复问题。要安装包含更改的软件包,请在解压目录中运行cabal install
。无论如何,请给维护人员留言,我相信他会提供帮助。The Haskell Platform comes with a binding to OpenGL which should work out of the box on Windows.
Concerning the SDL package on hackage, you can use
cabal unpack SDL
to get the source code and fix things yourself. To install the package with your changes, runcabal install
in the unpacked directory. In any case, drop a line to the maintainer, I'm sure he'll help out.它与SDL无关,但你提到了OpenGL。 OCaml 中有 LablGL 绑定 OpenGL,可以使用开箱即用。维基示例 (http://en.wikipedia.org/wiki/Objective_Caml#Triangle_ .28graphics.29) 编译并运行得很好。
It's not related to SDL, but you've mentioned OpenGL. There is LablGL binding for OpenGL in OCaml which works out of the box. Wiki example (http://en.wikipedia.org/wiki/Objective_Caml#Triangle_.28graphics.29) compiles and works just fine.
我找到的关于让 SDL 在具有最新 Haskell 平台的 Windows 中工作的最佳说明可以在 此博客。尽管有一些配置错误消息,但我一步一步地遵循了所有内容,并且它运行得很好。
The best instructions I've found for getting SDL to work in windows with a the most recent Haskell platform can be found at this blog. I followed everything step-by-step and it worked perfectly, despite some configure error messages.
它不是 SDL,但 GLFW 通过 Cabal 在 Windows 上与 Haskell 一起工作。
It isn't SDL but GLFW works on Windows with Haskell through Cabal.
我的文章使用 OpenGL 2 实现高保真图形(2008 年 2 月 25 日)解释了如何使用 GLCaml 绑定在 OCaml 中编写基于 OpenGL 的应用程序使用顶点和片段着色器(以 phong 着色器为例)。 OCaml Journal 中有关于 OpenGL 的 9 篇文章,尽管大部分都使用较旧的 LablGL OpenGL 1.1 库。
2007 年,我尝试让 OpenGL 在 Linux 下的 Haskell 上工作,但失败了。 Haskell 平台 可能已经改变了这一点但我自己还没有时间尝试,也没有听说过有人用它来做这个。
然而,OCaml 和 Haskell 都必须依赖于 OpenGL 的脆弱的低级绑定,因为它们是独立的语言,并且没有人设法让任何重要的商业软件使用它们来工作。当您使用 Windows 时,F#+XNA 是一个更合理的选择,因为 XNA 经过尝试和测试,并且 F# 具有安全的高级接口。 Google 之战让您清楚地了解自己将成为什么样的先驱:+haskell +opengl 给出 437 Google 上的点击率和 +ocaml +opengl 仅给出 347 次点击。
My article High-fidelity graphics with OpenGL 2 (25th Feb 2008) explained how the GLCaml bindings can be used to write OpenGL-based applications in OCaml that use vertex and fragment shaders (a phong shader is given as an example). There are 9 articles in the OCaml Journal on OpenGL, albeit mostly using the older LablGL library for OpenGL 1.1.
I tried and failed to get OpenGL working from Haskell under Linux in 2007. The Haskell Platform may have changed that but I have neither had time to try it yet myself nor ever heard of anyone using it for this.
However, both OCaml and Haskell must rely upon fragile low-level bindings to OpenGL because they are standalone languages and nobody has ever managed to get any significant commercial software using them to work. As you're on Windows, F#+XNA is a far more logical choice because XNA is tried and tested and F# has a safe high-level interface to it. A Google fight gives you a good idea of what a pioneer you'll be: +haskell +opengl gives 437 hits on Google and +ocaml +opengl gives only 347 hits.