白色矩形代替TextureRegion(使用libgdx)

时间:2013-03-03 20:55:06

标签: android textures libgdx

标题中的子喷射

加载纹理,制作

private static Map<String, Texture> textureAlreadyLoad = new HashMap<String, Texture>();

加载源

String location = tagMap.get("location");
Texture texture;

if(textureAlreadyLoad.containsKey(location)) {
    texture = textureAlreadyLoad.get(location);
} else {
    texture = new Texture(Gdx.files.internal(location));
    textureAlreadyLoad.put(location, texture);
}

graphic = new StaticGraphic(state, new TextureRegion(texture)); 

支持班级

public class GraphicStorage {
    private Map<Pair<String, State>, ActorGraphic> ActorsGraphic;

    public GraphicStorage() {
        ActorsGraphic = ResourceProvider.getMapGraphic();
    }

    public ActorGraphic getGraphic(String className, State state) {
        return ActorsGraphic.get(new Pair<String, State>(className, state));
    }
}

然后我只是通过spriteBatch绘制 - 只有64x64白色矩形(图像大小) 这是我使用一张图片的一点。

在地图中存储纹理是否合适?

0 个答案:

没有答案