Game Running slow in Android Handsets, no use of textures only using ShapeRenderer to draw shapes

a 夏天 提交于 2019-12-12 03:28:15

问题


I am making a game in which i am making arcs using ShapeRenderer, As i needed to rotate those arcs around the center so i wrote that code only begin and end in render method, I am initializing them in create method, But as the number of arcs increases the game gets slower and slower. I have maximum of 13 arcs and minimum 2 arcs. It running fine till few say 8 arcs and after that it gets slower. Please any one out there if he/she can help, please help... thanks in advance.

Render Method is having 5 loops, I don't have any choice to get rid of them.

this is in create:

for (int i = 0; i < 13; i++) { random = randomGenerator.nextInt(5); a[i] = new Arc(arcColors[random]); arcs_visible[i] = 1; pointercolor[i] = a[i].getArcColor(); a[i].begin(ShapeRenderer.ShapeType.Line); }

this is in render:

private void draw_one_arc(int i, double radius, float startangle, float sweep) {
        if (arcs_visible[i] == 1 && collides[i] == false) {

            a[i].arc(pointerorigin.x + pointer.getWidth() / 2, pointerorigin.y + pointer.getWidth() / 2, (float) radius, startangle, sweep, 100);
        }

    }

`

来源:https://stackoverflow.com/questions/37007151/game-running-slow-in-android-handsets-no-use-of-textures-only-using-shaperender

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!