Libgdx Android Game Drawing Shapes (Bitmap vs. SVG)

Disclaimer: I'm new to Libgdx and android programming in general.

My game needs simple shapes (squares, circles, etc.)

I want the shapes to look very clean (especially around the edges).

Vector shapes (aside from maybe circles) would produce the graphics I want.

What are the pros and cons of bitmap images (TextureAtlas) instead of SVG (ShapeRenderer)?

Bitmap TextureAtlas:

Can I animate bitmaps (scaling size up and down) without them looking pixelated?

Can I hue/change colors of shapes with bitmap AtlasRegions (basically textures)?

SVG ShapeRenderer:

Would SVG/ShapeRenderer really be that slow?


From my experience, drawing smooth shapes with the ShapeRenderer can destroy your framerate (I lost about 100 fps with my mini benchmark.) However, I did not benchmark this fully and it also depends on how many segments are rendered (more segments, smoother shapes).

I think you're best off making high-res bitmaps. They should not look pixelated if they are scaled down. You can also tint your bitmaps with a SpriteBatch.

I hope this answered your question :)


LibGDX doesn't support vectorial graphics (SVG)..

The best thing you can do is providing graphics for different screen sizes, and use the ResolutionFileResolver class to help you getting the closest graphics you have acording to your screen resolution.

This is a good ideea because you don't want to use HD graphics on a samsung galaxy mini, that would kill your framerate, and also you don't want SD graphics on a HD phone or tablet, because it would look pixelated.

链接地址: http://www.djcxy.com/p/68964.html

上一篇: 自定义ViewGroup与循环子

下一篇: Libgdx Android游戏绘图形状(位图与SVG)