0
私のドラゴンをテクスチャとして使用するにはどうすればよいですか? TextureRegion
からTexture
を作成するlibGDX:TextureRegionをテクスチャに変換する
atlas = new TextureAtlas("myPack.atlas");
dragon = dragon.findRegion("dragon"); // returns TextureRegion
私のドラゴンをテクスチャとして使用するにはどうすればよいですか? TextureRegion
からTexture
を作成するlibGDX:TextureRegionをテクスチャに変換する
atlas = new TextureAtlas("myPack.atlas");
dragon = dragon.findRegion("dragon"); // returns TextureRegion
は全く無意味です。
あなたはピックスマップとそのPixmap
からTexture
を作成するために、特定のテクセルを書き込むことができますので、あなたのTextureRegion
は、あなたのテクスチャの長方形の点を有します。
TextureAtlas.TextureAtlasData.Region dragon = atlas.getRegion("dragon");
Pixmap pixmap = new Pixmap(dragon.width, dragon.height, Pixmap.Format.RGBA8888);
FileHandle pngFile = dragon.page.textureFile;
Pixmap completePix = new Pixmap(pngFile);
pixmap.drawPixmap(completePix, 0, 0, dragon.left, dragon.top, dragon.width, dragon.height);
Texture dragonTex=new Texture(pixmap);
'atlas.findRegion(" dragon ");'? – Aryan