如何绘制多边形填充? [机器人,Andengine] [英] How to draw filled polygon ? [Android, Andengine]
本文介绍了如何绘制多边形填充? [机器人,Andengine]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想提请填充多边形Andengine gles2。
I want to draw filled polygon in Andengine gles2.
我有多边形顶点。我怎么能画呢?的问题是,它可以具有任何数量的顶点(4,30)。
I have vertices of polygon. How I can draw it? The problem is that it can have any number of vertices (4, 30).
接下来的问题是,我想填补这个多边形我的形象(或只是颜色如果没有可能)。
Next problem is that I want fill this polygon with my image(or just color if not possible).
T能够找到这个任何功能。可能吗 ?
Can' t find any function for this. Is it possible ?
推荐答案
这样,您就可以在它的重复图像创建多边形。
This way you can create polygon with repeating image in it.
final float offsetX = 0f;
final float offsetY = 115f;
final float[] vertexX1 = { 200f-offsetX, 400f-offsetX, 300f-offsetX, 200f-offsetX};
final float[] vertexY1 = { 200f-offsetY, 200f-offsetY, 300f-offsetY, 300f-offsetY};
final TexturedPolygon myRepeatingSpriteShape = new TexturedPolygon(offsetX, offsetY, vertexX1, vertexY1, myTextureRegion, this.getVertexBufferObjectManager());
mScene.attachChild(myRepeatingSpriteShape);
这实现由社区成员的 recastrodiaz 的一个创造。我认为这将解决您的问题。
This implementation was created by one of the community member recastrodiaz. I think this will solve your problem.
这篇关于如何绘制多边形填充? [机器人,Andengine]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文