本文整理汇总了Java中org.andengine.opengl.texture.region.TextureRegionFactory.extractTiledFromTexture方法的典型用法代码示例。如果您正苦于以下问题:Java TextureRegionFactory.extractTiledFromTexture方法的具体用法?Java TextureRegionFactory.extractTiledFromTexture怎么用?Java TextureRegionFactory.extractTiledFromTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.opengl.texture.region.TextureRegionFactory
的用法示例。
在下文中一共展示了TextureRegionFactory.extractTiledFromTexture方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTiledTextureFromAsset
import org.andengine.opengl.texture.region.TextureRegionFactory; //导入方法依赖的package包/类
private TiledTextureRegion getTiledTextureFromAsset(final String path, int rows, int columns) {
try {
texture = new BitmapTexture(engine.getTextureManager(), new IInputStreamOpener() {
@Override
public InputStream open() throws IOException {
return context.getAssets().open("gfx/" + path); // path of the image
}
}, TextureOptions.BILINEAR);
texture.load();
return TextureRegionFactory.extractTiledFromTexture(texture, rows, columns);
} catch (IOException e) {
e.printStackTrace();
Log.e(ASSETS_ERROR_TAG, e.toString());
}
return null;
}
示例2: loadLocaleDefaults
import org.andengine.opengl.texture.region.TextureRegionFactory; //导入方法依赖的package包/类
private void loadLocaleDefaults() throws IOException {
try {
inventoryTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, this.locale.inventoryBlock.block_texture);
inventoryTexture.load();
int[] inventoryTileSize = GameTextures.calculateTileSize(locale.inventoryBlock.columns, locale.inventoryBlock.rows, locale.inventoryBlock.height);
inventoryTiles = TextureRegionFactory.extractTiledFromTexture(inventoryTexture, 0, 0, inventoryTileSize[0] * 4, inventoryTileSize[1] * 2, 4, 2);
this.spriteMasks.put(inventoryTiles, AssetBitmapTextureAtlasSource.create(PhoeniciaContext.assetManager, this.locale.inventoryBlock.block_texture).onLoadBitmap(Bitmap.Config.ALPHA_8));
marketTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, this.locale.marketBlock.block_texture);
marketTexture.load();
int[] marketTileSize = GameTextures.calculateTileSize(locale.marketBlock.columns, locale.marketBlock.rows, locale.marketBlock.height);
marketTiles = TextureRegionFactory.extractTiledFromTexture(marketTexture, 0, 0, marketTileSize[0] * 4, marketTileSize[1] * 2, 4, 2);
this.spriteMasks.put(marketTiles, AssetBitmapTextureAtlasSource.create(PhoeniciaContext.assetManager, this.locale.marketBlock.block_texture).onLoadBitmap(Bitmap.Config.ALPHA_8));
workshopTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, this.locale.workshopBlock.block_texture);
workshopTexture.load();
int[] workshopTileSize = GameTextures.calculateTileSize(locale.workshopBlock.columns, locale.workshopBlock.rows, locale.workshopBlock.height);
workshopTiles = TextureRegionFactory.extractTiledFromTexture(workshopTexture, 0, 0, workshopTileSize[0] * 4, workshopTileSize[1] * 2, 4, 2);
this.spriteMasks.put(workshopTiles, AssetBitmapTextureAtlasSource.create(PhoeniciaContext.assetManager, this.locale.workshopBlock.block_texture).onLoadBitmap(Bitmap.Config.ALPHA_8));
} catch (final IOException e) {
e.printStackTrace();
throw e;
}
}
示例3: getMusicIcon
import org.andengine.opengl.texture.region.TextureRegionFactory; //导入方法依赖的package包/类
public ITiledTextureRegion getMusicIcon() {
return TextureRegionFactory.extractTiledFromTexture(this.gameui, GU * 6, GU * 5, GU * 2, GU * 1, 2, 1);
}
示例4: loadGraphics
import org.andengine.opengl.texture.region.TextureRegionFactory; //导入方法依赖的package包/类
private void loadGraphics(final String player1Drawable, final String player2Drawable) {
try {
mPlayer1_Texture = new AssetBitmapTexture(mActivity.getTextureManager(), mActivity.getAssets(), GRAPHICS_DIR+player1Drawable, TextureOptions.BILINEAR);
mPlayer1_Texture.load();
mPlayer1_TextureRegion = TextureRegionFactory.extractTiledFromTexture(mPlayer1_Texture, 2, 2);
mPlayer2_Texture = new AssetBitmapTexture(mActivity.getTextureManager(), mActivity.getAssets(), GRAPHICS_DIR+player2Drawable, TextureOptions.BILINEAR);
mPlayer2_Texture.load();
mPlayer2_TextureRegion = TextureRegionFactory.extractTiledFromTexture(mPlayer2_Texture, 2, 2);
mBall_Texture = new AssetBitmapTexture(mActivity.getTextureManager(), mActivity.getAssets(), GRAPHICS_DIR+"ball.png", TextureOptions.BILINEAR);
mBall_Texture.load();
mBall_TextureRegion = TextureRegionFactory.extractFromTexture(mBall_Texture);
mBackground_Texture = new AssetBitmapTexture(mActivity.getTextureManager(), mActivity.getAssets(), GRAPHICS_DIR+GRAPHIC_FIELD_TILE, TextureOptions.REPEATING_BILINEAR);
mBackground_Texture.load();
mBackground_TextureRegion = TextureRegionFactory.extractFromTexture(mBackground_Texture);
mFieldLeft_Texture = new AssetBitmapTexture(mActivity.getTextureManager(), mActivity.getAssets(), GRAPHICS_DIR+GRAPHIC_FIELD_LEFT, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
mFieldLeft_Texture.load();
mFieldLeft_TextureRegion = TextureRegionFactory.extractFromTexture(mFieldLeft_Texture);
mFieldRight_Texture = new AssetBitmapTexture(mActivity.getTextureManager(), mActivity.getAssets(), GRAPHICS_DIR+GRAPHIC_FIELD_RIGHT, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
mFieldRight_Texture.load();
mFieldRight_TextureRegion = TextureRegionFactory.extractFromTexture(mFieldRight_Texture);
mFieldCenter_Texture = new AssetBitmapTexture(mActivity.getTextureManager(), mActivity.getAssets(), GRAPHICS_DIR+GRAPHIC_FIELD_CENTER, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
mFieldCenter_Texture.load();
mFieldCenter_TextureRegion = TextureRegionFactory.extractFromTexture(mFieldCenter_Texture);
mControlLeft_Texture = new AssetBitmapTexture(mActivity.getTextureManager(), mActivity.getAssets(), GRAPHICS_DIR+GRAPHIC_CONTROL_LEFT, TextureOptions.BILINEAR);
mControlLeft_Texture.load();
mControlLeft_TextureRegion = TextureRegionFactory.extractFromTexture(mControlLeft_Texture);
mControlRight_Texture = new AssetBitmapTexture(mActivity.getTextureManager(), mActivity.getAssets(), GRAPHICS_DIR+GRAPHIC_CONTROL_RIGHT, TextureOptions.BILINEAR);
mControlRight_Texture.load();
mControlRight_TextureRegion = TextureRegionFactory.extractFromTexture(mControlRight_Texture);
mControlUp_Texture = new AssetBitmapTexture(mActivity.getTextureManager(), mActivity.getAssets(), GRAPHICS_DIR+GRAPHIC_CONTROL_UP, TextureOptions.BILINEAR);
mControlUp_Texture.load();
mControlUp_TextureRegion = TextureRegionFactory.extractFromTexture(mControlUp_Texture);
}
catch (IOException e) {
throw new RuntimeException(e);
}
}