org.andengine.opengl.texture.region.TextureRegionFactory Java Examples

The following examples show how to use org.andengine.opengl.texture.region.TextureRegionFactory. 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: WorldController.java    From tilt-game-android with MIT License 6 votes vote down vote up
private void createBall(Vector2 location) {
    if (location == null) return;

    createPhysicalBall(location);

    AssetBitmapTexture texture;
    try {
        texture = new AssetBitmapTexture(_engine.getTextureManager(), GoogleFlipGameApplication.sContext.getAssets(), "ball.png");
    } catch (IOException e) {
        e.printStackTrace();
        return;
    }
    texture.load();

    _ballSprite = new Ball(location.x, location.y, TextureRegionFactory.extractFromTexture(texture), _engine.getVertexBufferObjectManager());
    _ballSprite.setWidth(2 * BALL_SIZE_FACTOR * _width);
    _ballSprite.setHeight(2 * BALL_SIZE_FACTOR * _width);
    attachChild(_ballSprite);
}
 
Example #2
Source File: WorldController.java    From tilt-game-android with MIT License 6 votes vote down vote up
private SpawnHole drawHole(Vector2 location, String textureName) {
    AssetBitmapTexture texture;
    try {
        texture = new AssetBitmapTexture(_engine.getTextureManager(), GoogleFlipGameApplication.sContext.getAssets(), textureName, TextureOptions.BILINEAR);
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
    texture.load();
    SpawnHole hole = new SpawnHole(location.x, location.y, TextureRegionFactory.extractFromTexture(texture), _engine.getVertexBufferObjectManager());
    hole.setWidth(SINKHOLE_SIZE_FACTOR * _width);
    hole.setHeight(SINKHOLE_SIZE_FACTOR * _width);
    attachChild(hole);

    return hole;
}
 
Example #3
Source File: ResourceLoader.java    From sopa with Apache License 2.0 6 votes vote down vote up
TextureRegion getTexture(final String path) {

        try {
            ITexture texture = new BitmapTexture(textureManager, new IInputStreamOpener() {

                        @Override
                        public InputStream open() throws IOException {

                            return assetManager.open(path);
                        }
                    }, TextureOptions.BILINEAR);

            return TextureRegionFactory.extractFromTexture(texture);
        } catch (IOException e) {
            e.printStackTrace();
        }

        return null;
    }
 
Example #4
Source File: AndEngineActivity.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreateResources() throws IOException {
    mTexture = new AssetBitmapTexture(getTextureManager(), getAssets(), "player.png");
    mTextureRegion = TextureRegionFactory.extractFromTexture(mTexture);
    mTexture.load();

    mBitmapTextureAtlas = new BitmapTextureAtlas(getTextureManager(), 100, 100, TextureOptions.BILINEAR);
    mTiledTextureRegion = BitmapTextureAtlasTextureRegionFactory
            .createTiledFromAsset(mBitmapTextureAtlas, getAssets(), "npc-oldman1.png", 0, 0, 4, 1);

    mBitmapTextureAtlas.load();
}
 
Example #5
Source File: BitmapTextureAtlasTextureRegionFactory.java    From tilt-game-android with MIT License 4 votes vote down vote up
public static TextureRegion createFromSource(final BitmapTextureAtlas pBitmapTextureAtlas, final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final int pTextureX, final int pTextureY) {
	return TextureRegionFactory.createFromSource(pBitmapTextureAtlas, pBitmapTextureAtlasSource, pTextureX, pTextureY);
}
 
Example #6
Source File: BitmapTextureAtlasTextureRegionFactory.java    From tilt-game-android with MIT License 4 votes vote down vote up
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 #7
Source File: BitmapTextureAtlasTextureRegionFactory.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public static TextureRegion createFromSource(final BitmapTextureAtlas pBitmapTextureAtlas, final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final int pTextureX, final int pTextureY) {
	return TextureRegionFactory.createFromSource(pBitmapTextureAtlas, pBitmapTextureAtlasSource, pTextureX, pTextureY);
}
 
Example #8
Source File: BitmapTextureAtlasTextureRegionFactory.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
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);
}