如何在libgdx中填充一个圆圈? [英] How can I fill a circle in libgdx?

查看:114
本文介绍了如何在libgdx中填充一个圆圈?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 ShapeRenderer 类,我只能填充矩形.

using the ShapeRenderer class, I can only fill rectangles.

  • 那我怎么填个圆圈?
  • 如果可能的话,填满一个扇区(圆的一部分)?

推荐答案

如Shaperender的示例

As in the example of the shaperender

 shapeRenderer.begin(ShapeType.Filled);
 shapeRenderer.setColor(0, 1, 0, 1);
 shapeRenderer.rect(x, y, width, height); // fills a rect
 shapeRenderer.circle(x, y, radius);//<--- fills a circle
 shapeRenderer.end();

应填充圆圈.我不知道如何获得冰柱的一部分.也许创建一个网格并填充它或类似的东西.看一下Shaperender,有不同的方法可以填充零件.只需检查其中是否合适即可.

should fill the circle. How to get a portion of a cicle i have no clue. Maybe create a mesh and fill it or such like that. Take a look at the shaperender there are differnet methods to fill parts. Just check if some of them fit.

这篇关于如何在libgdx中填充一个圆圈?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆