私はAndEngineでAndroidプログラミングを行っていましたが、Hashtablesでいくつかの奇妙なことに遭遇しました。
基本的に私がこれを行う場合:
BitmapTextureAtlas m_textureAtlas = new BitmapTextureAtlas(p_baseActivity.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
TextureRegion texture1 = BitmapTextureAtlasTextureRegionFactory.createFromAsset(m_textureAtlas, p_baseActivity, "Chrysanthemum.jpg", 0, 0);
m_textureAtlas.load();
Sprite m_sprite1 = new Sprite(0, 0, texture1, p_baseActivity.getEngine().getVertexBufferObjectManager());
this.attachChild(m_sprite1);
すべての言葉は大丈夫です。しかし、私がこれを行う場合:
BitmapTextureAtlas m_textureAtlas = new BitmapTextureAtlas(p_baseActivity.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
Hashtable<String, TextureRegion> test = new Hashtable<String, TextureRegion>();
TextureRegion texture1 = test.put("1", BitmapTextureAtlasTextureRegionFactory.createFromAsset(m_textureAtlas, p_baseActivity, "Chrysanthemum.jpg", 0, 0));
m_textureAtlas.load();
Sprite m_sprite1 = new Sprite(0, 0, texture1, p_baseActivity.getEngine().getVertexBufferObjectManager());
this.attachChild(m_sprite1);
それ(画像)がちらつき、寸法がすべて間違っています。今のところ、このプロジェクトの最初のコードセットを実行しても問題ありませんが、何か間違ったことをしているのか、put()の戻り値を完全に回避する必要があるのかわかりません。