开发者

draw rotated font with pygame

What's the best way to draw rotated text rendered with fonts with pygame? I can just draw the font then rotozoom it, but it seems better result would be gotten if it were possible to draw the glyphs directly rotated, especially t开发者_JS百科aking AA into account?


Pygame does not have the functionality you are looking for.

You will have to use the method you mention, i.e rotozoom on an the already rendered font. The quality of this method isn't all that bad actually. And concerning speed, you don't want to be rendering the fonts all the time anyway.

If you are desperate for speed, and the text isn't dynamic, you can always make a cache of i.e 32 directions for each text you want displayed. Pyglet will allow you to rotate sprites for "free", i.e hardware accelerated.

Or you can go look at the raw SDL libraries pygame uses and see if you can find something that draws rotated fonts directly and hack pygame to use it.


You can use a pyOpenGL surface in pygame, if that simplifies it for you. Pyglet also uses OpenGL.

(for pygame surfaces) You can cache the rendered text, using that to rotate. Or pre-cache all 32 directions. [ see other answer ]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜