org.andengine.opengl.texture.region.TiledTextureRegion Java Examples
The following examples show how to use
org.andengine.opengl.texture.region.TiledTextureRegion.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BuildableTextureAtlasTextureRegionFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 6 votes |
public static <T extends ITextureAtlasSource, A extends ITextureAtlas<T>> TiledTextureRegion createTiledFromSource(final BuildableTextureAtlas<T, A> pBuildableTextureAtlas, final T pTextureAtlasSource, final int pTileColumns, final int pTileRows) { final TiledTextureRegion tiledTextureRegion = TiledTextureRegion.create(pBuildableTextureAtlas, 0, 0, pTextureAtlasSource.getTextureWidth(), pTextureAtlasSource.getTextureHeight(), pTileColumns, pTileRows); pBuildableTextureAtlas.addTextureAtlasSource(pTextureAtlasSource, new Callback<T>() { @Override public void onCallback(final T pCallbackValue) { final int tileWidth = pTextureAtlasSource.getTextureWidth() / pTileColumns; final int tileHeight = pTextureAtlasSource.getTextureHeight() / pTileRows; for(int tileColumn = 0; tileColumn < pTileColumns; tileColumn++) { for(int tileRow = 0; tileRow < pTileRows; tileRow++) { final int tileIndex = tileRow * pTileColumns + tileColumn; final int x = pCallbackValue.getTextureX() + tileColumn * tileWidth; final int y = pCallbackValue.getTextureY() + tileRow * tileHeight; tiledTextureRegion.setTexturePosition(tileIndex, x, y); } } } }); return tiledTextureRegion; }
Example #2
Source File: BitmapTextureAtlasTextureRegionFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 6 votes |
/** * Loads all files from a given assets directory (in alphabetical order) as consecutive tiles of an {@link TiledTextureRegion}. * * @param pBuildableBitmapTextureAtlas * @param pAssetManager * @param pAssetSubdirectory to load all files from "gfx/flowers" put "flowers" here (assuming, that you've used {@link BitmapTextureAtlasTextureRegionFactory#setAssetBasePath(String)} with "gfx/" before.) * @return */ public static TiledTextureRegion createTiledFromAssetDirectory(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetSubdirectory) { final String[] files; try { files = pAssetManager.list(BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetSubdirectory); } catch (final IOException e) { throw new AndEngineRuntimeException("Listing assets subdirectory: '" + BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetSubdirectory + "' failed. Does it exist?", e); } final int fileCount = files.length; final TextureRegion[] textures = new TextureRegion[fileCount]; for (int i = 0; i < fileCount; i++) { final String assetPath = pAssetSubdirectory + "/" + files[i]; textures[i] = BitmapTextureAtlasTextureRegionFactory.createFromAsset(pBuildableBitmapTextureAtlas, pAssetManager, assetPath); } return new TiledTextureRegion(pBuildableBitmapTextureAtlas, textures); }
Example #3
Source File: BitmapTextureAtlasTextureRegionFactory.java From tilt-game-android with MIT License | 6 votes |
/** * Loads all files from a given assets directory (in alphabetical order) as consecutive tiles of an {@link TiledTextureRegion}. * * @param pBuildableBitmapTextureAtlas * @param pAssetManager * @param pAssetSubdirectory to load all files from "gfx/flowers" put "flowers" here (assuming, that you've used {@link BitmapTextureAtlasTextureRegionFactory#setAssetBasePath(String)} with "gfx/" before.) * @return */ public static TiledTextureRegion createTiledFromAssetDirectory(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetSubdirectory) { final String[] files; try { files = pAssetManager.list(BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetSubdirectory); } catch (final IOException e) { throw new AndEngineRuntimeException("Listing assets subdirectory: '" + BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetSubdirectory + "' failed. Does it exist?", e); } final int fileCount = files.length; final TextureRegion[] textures = new TextureRegion[fileCount]; for (int i = 0; i < fileCount; i++) { final String assetPath = pAssetSubdirectory + "/" + files[i]; textures[i] = BitmapTextureAtlasTextureRegionFactory.createFromAsset(pBuildableBitmapTextureAtlas, pAssetManager, assetPath); } return new TiledTextureRegion(pBuildableBitmapTextureAtlas, textures); }
Example #4
Source File: BuildableTextureAtlasTextureRegionFactory.java From tilt-game-android with MIT License | 6 votes |
public static <T extends ITextureAtlasSource, A extends ITextureAtlas<T>> TiledTextureRegion createTiledFromSource(final BuildableTextureAtlas<T, A> pBuildableTextureAtlas, final T pTextureAtlasSource, final int pTileColumns, final int pTileRows) { final TiledTextureRegion tiledTextureRegion = TiledTextureRegion.create(pBuildableTextureAtlas, 0, 0, pTextureAtlasSource.getTextureWidth(), pTextureAtlasSource.getTextureHeight(), pTileColumns, pTileRows); pBuildableTextureAtlas.addTextureAtlasSource(pTextureAtlasSource, new Callback<T>() { @Override public void onCallback(final T pCallbackValue) { final int tileWidth = pTextureAtlasSource.getTextureWidth() / pTileColumns; final int tileHeight = pTextureAtlasSource.getTextureHeight() / pTileRows; for (int tileColumn = 0; tileColumn < pTileColumns; tileColumn++) { for (int tileRow = 0; tileRow < pTileRows; tileRow++) { final int tileIndex = tileRow * pTileColumns + tileColumn; final int x = pCallbackValue.getTextureX() + tileColumn * tileWidth; final int y = pCallbackValue.getTextureY() + tileRow * tileHeight; tiledTextureRegion.setTexturePosition(tileIndex, x, y); } } } }); return tiledTextureRegion; }
Example #5
Source File: ButtonSprite.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public ButtonSprite(final float pX, final float pY, final ITextureRegion pNormalTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager, final OnClickListener pOnClickListener) { this(pX, pY, new TiledTextureRegion(pNormalTextureRegion.getTexture(), pNormalTextureRegion), pVertexBufferObjectManager, pOnClickListener); }
Example #6
Source File: BitmapTextureAtlasTextureRegionFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static TiledTextureRegion createTiledFromSource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final int pTileColumns, final int pTileRows) { return BuildableTextureAtlasTextureRegionFactory.createTiledFromSource(pBuildableBitmapTextureAtlas, pBitmapTextureAtlasSource, pTileColumns, pTileRows); }
Example #7
Source File: BitmapTextureAtlasTextureRegionFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static TiledTextureRegion createTiledFromResource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Resources pResources, final int pDrawableResourceID, final int pTileColumns, final int pTileRows) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = ResourceBitmapTextureAtlasSource.create(pResources, pDrawableResourceID); return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBuildableBitmapTextureAtlas, bitmapTextureAtlasSource, pTileColumns, pTileRows); }
Example #8
Source File: BitmapTextureAtlasTextureRegionFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static TiledTextureRegion createTiledFromResource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Context pContext, final int pDrawableResourceID, final int pTileColumns, final int pTileRows) { return BitmapTextureAtlasTextureRegionFactory.createTiledFromResource(pBuildableBitmapTextureAtlas, pContext.getResources(), pDrawableResourceID, pTileColumns, pTileRows); }
Example #9
Source File: BitmapTextureAtlasTextureRegionFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static TiledTextureRegion createTiledFromAsset(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetPath, final int pTileColumns, final int pTileRows) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = AssetBitmapTextureAtlasSource.create(pAssetManager, BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetPath); return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBuildableBitmapTextureAtlas, bitmapTextureAtlasSource, pTileColumns, pTileRows); }
Example #10
Source File: BitmapTextureAtlasTextureRegionFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static TiledTextureRegion createTiledFromAsset(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Context pContext, final String pAssetPath, final int pTileColumns, final int pTileRows) { return BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(pBuildableBitmapTextureAtlas, pContext.getAssets(), pAssetPath, pTileColumns, pTileRows); }
Example #11
Source File: BitmapTextureAtlasTextureRegionFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static TiledTextureRegion createTiledFromSource(final BitmapTextureAtlas pBitmapTextureAtlas, final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { return TextureRegionFactory.createTiledFromSource(pBitmapTextureAtlas, pBitmapTextureAtlasSource, pTextureX, pTextureY, pTileColumns, pTileRows); }
Example #12
Source File: BitmapTextureAtlasTextureRegionFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static TiledTextureRegion createTiledFromResource(final BitmapTextureAtlas pBitmapTextureAtlas, final Resources pResources, final int pDrawableResourceID, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = ResourceBitmapTextureAtlasSource.create(pResources, pDrawableResourceID); return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBitmapTextureAtlas, bitmapTextureAtlasSource, pTextureX, pTextureY, pTileColumns, pTileRows); }
Example #13
Source File: BitmapTextureAtlasTextureRegionFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static TiledTextureRegion createTiledFromResource(final BitmapTextureAtlas pBitmapTextureAtlas, final Context pContext, final int pDrawableResourceID, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { return BitmapTextureAtlasTextureRegionFactory.createTiledFromResource(pBitmapTextureAtlas, pContext.getResources(), pDrawableResourceID, pTextureX, pTextureY, pTileColumns, pTileRows); }
Example #14
Source File: BitmapTextureAtlasTextureRegionFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static TiledTextureRegion createTiledFromAsset(final BitmapTextureAtlas pBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetPath, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = AssetBitmapTextureAtlasSource.create(pAssetManager, BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetPath); return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBitmapTextureAtlas, bitmapTextureAtlasSource, pTextureX, pTextureY, pTileColumns, pTileRows); }
Example #15
Source File: BitmapTextureAtlasTextureRegionFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static TiledTextureRegion createTiledFromAsset(final BitmapTextureAtlas pBitmapTextureAtlas, final Context pContext, final String pAssetPath, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { return BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(pBitmapTextureAtlas, pContext.getAssets(), pAssetPath, pTextureX, pTextureY, pTileColumns, pTileRows); }
Example #16
Source File: ButtonSprite.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public ButtonSprite(final float pX, final float pY, final ITextureRegion pNormalTextureRegion, final ITextureRegion pPressedTextureRegion, final ITextureRegion pDisabledTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager, final OnClickListener pOnClickListener) { this(pX, pY, new TiledTextureRegion(pNormalTextureRegion.getTexture(), pNormalTextureRegion, pPressedTextureRegion, pDisabledTextureRegion), pVertexBufferObjectManager, pOnClickListener); }
Example #17
Source File: ButtonSprite.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public ButtonSprite(final float pX, final float pY, final ITextureRegion pNormalTextureRegion, final ITextureRegion pPressedTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager, final OnClickListener pOnClickListener) { this(pX, pY, new TiledTextureRegion(pNormalTextureRegion.getTexture(), pNormalTextureRegion, pPressedTextureRegion), pVertexBufferObjectManager, pOnClickListener); }
Example #18
Source File: ButtonSprite.java From tilt-game-android with MIT License | 4 votes |
public ButtonSprite(final float pX, final float pY, final ITextureRegion pNormalTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager, final OnClickListener pOnClickListener) { this(pX, pY, new TiledTextureRegion(pNormalTextureRegion.getTexture(), pNormalTextureRegion), pVertexBufferObjectManager, pOnClickListener); }
Example #19
Source File: BitmapTextureAtlasTextureRegionFactory.java From tilt-game-android with MIT License | 4 votes |
public static TiledTextureRegion createTiledFromSource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final int pTileColumns, final int pTileRows) { return BuildableTextureAtlasTextureRegionFactory.createTiledFromSource(pBuildableBitmapTextureAtlas, pBitmapTextureAtlasSource, pTileColumns, pTileRows); }
Example #20
Source File: BitmapTextureAtlasTextureRegionFactory.java From tilt-game-android with MIT License | 4 votes |
public static TiledTextureRegion createTiledFromResource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Resources pResources, final int pDrawableResourceID, final int pTileColumns, final int pTileRows) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = ResourceBitmapTextureAtlasSource.create(pResources, pDrawableResourceID); return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBuildableBitmapTextureAtlas, bitmapTextureAtlasSource, pTileColumns, pTileRows); }
Example #21
Source File: BitmapTextureAtlasTextureRegionFactory.java From tilt-game-android with MIT License | 4 votes |
public static TiledTextureRegion createTiledFromResource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Context pContext, final int pDrawableResourceID, final int pTileColumns, final int pTileRows) { return BitmapTextureAtlasTextureRegionFactory.createTiledFromResource(pBuildableBitmapTextureAtlas, pContext.getResources(), pDrawableResourceID, pTileColumns, pTileRows); }
Example #22
Source File: BitmapTextureAtlasTextureRegionFactory.java From tilt-game-android with MIT License | 4 votes |
public static TiledTextureRegion createTiledFromAsset(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetPath, final int pTileColumns, final int pTileRows) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = AssetBitmapTextureAtlasSource.create(pAssetManager, BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetPath); return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBuildableBitmapTextureAtlas, bitmapTextureAtlasSource, pTileColumns, pTileRows); }
Example #23
Source File: BitmapTextureAtlasTextureRegionFactory.java From tilt-game-android with MIT License | 4 votes |
public static TiledTextureRegion createTiledFromAsset(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Context pContext, final String pAssetPath, final int pTileColumns, final int pTileRows) { return BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(pBuildableBitmapTextureAtlas, pContext.getAssets(), pAssetPath, pTileColumns, pTileRows); }
Example #24
Source File: BitmapTextureAtlasTextureRegionFactory.java From tilt-game-android with MIT License | 4 votes |
public static TiledTextureRegion createTiledFromSource(final BitmapTextureAtlas pBitmapTextureAtlas, final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { return TextureRegionFactory.createTiledFromSource(pBitmapTextureAtlas, pBitmapTextureAtlasSource, pTextureX, pTextureY, pTileColumns, pTileRows); }
Example #25
Source File: BitmapTextureAtlasTextureRegionFactory.java From tilt-game-android with MIT License | 4 votes |
public static TiledTextureRegion createTiledFromResource(final BitmapTextureAtlas pBitmapTextureAtlas, final Resources pResources, final int pDrawableResourceID, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = ResourceBitmapTextureAtlasSource.create(pResources, pDrawableResourceID); return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBitmapTextureAtlas, bitmapTextureAtlasSource, pTextureX, pTextureY, pTileColumns, pTileRows); }
Example #26
Source File: BitmapTextureAtlasTextureRegionFactory.java From tilt-game-android with MIT License | 4 votes |
public static TiledTextureRegion createTiledFromResource(final BitmapTextureAtlas pBitmapTextureAtlas, final Context pContext, final int pDrawableResourceID, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { return BitmapTextureAtlasTextureRegionFactory.createTiledFromResource(pBitmapTextureAtlas, pContext.getResources(), pDrawableResourceID, pTextureX, pTextureY, pTileColumns, pTileRows); }
Example #27
Source File: BitmapTextureAtlasTextureRegionFactory.java From tilt-game-android with MIT License | 4 votes |
public static TiledTextureRegion createTiledFromAsset(final BitmapTextureAtlas pBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetPath, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = AssetBitmapTextureAtlasSource.create(pAssetManager, BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetPath); return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBitmapTextureAtlas, bitmapTextureAtlasSource, pTextureX, pTextureY, pTileColumns, pTileRows); }
Example #28
Source File: BitmapTextureAtlasTextureRegionFactory.java From tilt-game-android with MIT License | 4 votes |
public static TiledTextureRegion createTiledFromAsset(final BitmapTextureAtlas pBitmapTextureAtlas, final Context pContext, final String pAssetPath, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { return BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(pBitmapTextureAtlas, pContext.getAssets(), pAssetPath, pTextureX, pTextureY, pTileColumns, pTileRows); }
Example #29
Source File: ButtonSprite.java From tilt-game-android with MIT License | 4 votes |
public ButtonSprite(final float pX, final float pY, final ITextureRegion pNormalTextureRegion, final ITextureRegion pPressedTextureRegion, final ITextureRegion pDisabledTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager, final OnClickListener pOnClickListener) { this(pX, pY, new TiledTextureRegion(pNormalTextureRegion.getTexture(), pNormalTextureRegion, pPressedTextureRegion, pDisabledTextureRegion), pVertexBufferObjectManager, pOnClickListener); }
Example #30
Source File: ButtonSprite.java From tilt-game-android with MIT License | 4 votes |
public ButtonSprite(final float pX, final float pY, final ITextureRegion pNormalTextureRegion, final ITextureRegion pPressedTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager, final OnClickListener pOnClickListener) { this(pX, pY, new TiledTextureRegion(pNormalTextureRegion.getTexture(), pNormalTextureRegion, pPressedTextureRegion), pVertexBufferObjectManager, pOnClickListener); }