タイトルの件名
テクスチャの読み込み、作成
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 の白い長方形 (画像のサイズ) のみ 1 つの画像を使用するのがポイントです。
マップにテクスチャを保存してもよろしいですか?