用于 2D 绘图的 Haskell 库

发布于 2024-10-31 13:42:38 字数 1539 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

怕倦 2024-11-07 13:42:38

我不会选择单个库,而是会快速概述所有库,如 Hackage 上的图形部分

基本框架:

OpenGL

GTK

cabal install cairo

QTHaskell

  • 用的比较少,但是用的时候,被显着使用。
  • 由于 C++ 问题,不在 Hackage 上,在此处找到
  • 著名用户:尼基和机器人,一款商业游戏。

SDL

cabal install sdl

X11

cabal install X11

古老的 Unix 用户界面。

示例:xmonad

GD

cabal install gd

GD图形系统。 黑客包

示例:wordcloudsparklines

HOgre

cabal install hogre

绑定到 Ogre 游戏图形系统

现在,除了这些游戏层之外,还有许多更高级别的框架和工具:

图表

cabal install diagrams

2D 矢量图(例如数学),基于 cairo 构建。

光泽

cabal install gloss

2D图形,非常简单的界面,相对较新。请参阅 TomMD 的评论。

Cal3D

cabal install cal3d

绑定到 Cal3D 动画包

黑板

cabal install chalkboard

用于生成图像的基于 OpenGL 的组合器,用于教学。

TeaHS

cabal install TeaHS

一个用于创建 2D 游戏的简单库,灵感来自Ruby 库 Tea

Instead of picking individual libraries, I'll have a go at a quick overview at all of them, as listed in the Graphics section on Hackage.

Basic frameworks:

OpenGL

GTK

cabal install cairo

QTHaskell

  • Relatively little use, but when it is used, it is used notably.
  • Not on Hackage, found here, due to C++ issues
  • Notable users: Nikki and the Robots, a commercial game.

SDL

cabal install sdl

X11

cabal install X11

Venerable Unix user interfaces.

Examples: xmonad.

GD

cabal install gd

The GD graphics system. Package on hackage.

Examples: wordcloud, sparklines.

HOgre

cabal install hogre

Bindings to the Ogre game graphics system.

Now, besides these game layers, there are many higher level frameworks and tools:

Diagrams

cabal install diagrams

2D vector diagrams (e.g. for math), built on cairo.

Gloss

cabal install gloss

2D graphics, very easy interface, relatively new. See TomMD's comment.

Cal3D

cabal install cal3d

Bindings to the Cal3D animation package.

Chalkboard

cabal install chalkboard

OpenGL-based combinators for generating images, used in teaching.

TeaHS

cabal install TeaHS

A simple library for use creating 2D games, inspired by the Ruby library Tea.

毁我热情 2024-11-07 13:42:38

如果您正在寻找专门的游戏库,您可以在此处找到许多选项< /a>. FunGEn 可能是这些库中的最佳选择。但是,您的问题似乎表明,如果您只想绘制文本并接收输入,那么游戏库有点矫枉过正。在这种情况下,您可能会选择更简单的东西,例如 HOpenGLhsSDL此处还列出了其他几个库。

编辑:经过更多研究,您可能会很好地使用 haskgame。我自己从未使用过它,但看起来它有一些功能 此处 正是您所寻找的。

If you're looking for a specialized game library, you have a number of options that you can find here. FunGEn is probably your best option out of those libraries. However, your question seems to suggest a game library would be a bit overkill, if all you're looking to do is draw text and receive input. In that case, you might opt for something simpler like HOpenGL or hsSDL. There are also several other libraries listed here.

Edit: After a bit more research, you might do well using haskgame. I've never used it myself, but it looks like it's got a few functions here that do exactly what you're looking for.

梦开始←不甜 2024-11-07 13:42:38

我推荐新的 Gloss 库 作为获得良好结果的简单方法。

光泽掩盖了简单绘制的痛苦
良好数据背后的矢量图形
类型和一些显示功能。
Gloss使用OpenGL和GLUT下
引擎盖,但你不必担心
关于其中任何一个。得到一些很酷的东西
不到 10 分钟就出现在屏幕上。

还有不错的示例,例如:

hello world

在此处输入图像描述

和一个很好的示例构建 植绒模拟器

另外,如果您要操作的是矢量和文本,diagrams 包可以产生非常好的结果。

I'd recommend the new Gloss library as an easy way to get good results.

Gloss hides the pain of drawing simple
vector graphics behind a nice data
type and a few display functions.
Gloss uses OpenGL and GLUT under the
hood, but you won't have to worry
about any of that. Get something cool
on the screen in under 10 minutes.

There are also nice examples, such as:

hello world

enter image description here

and a nice example building flocking simulators

Alternatively, if it is vectors and text you want to manipulate, the diagrams package on top of cairo can yield very good results.

同尘 2024-11-07 13:42:38

你可以使用Qt。这就是跨平台 Nikki And The Robots 所使用的。您可以查看他们的源代码并了解他们在做什么。

You could use Qt. That's what the cross platform Nikki And The Robots is using. You can see their source code and take a look at what they're doing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文