Java Code Examples for org.andengine.opengl.texture.TextureOptions#BILINEAR

The following examples show how to use org.andengine.opengl.texture.TextureOptions#BILINEAR . 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 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 2
Source File: PipePair.java    From OpenFlappyBird with Do What The F*ck You Want To Public License 6 votes vote down vote up
public static void onCreateResources(SimpleBaseGameActivity activity){

		// upper pipe		
		BitmapTextureAtlas upperPipeTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 130, 60, TextureOptions.BILINEAR);
		mUpperPipeTexture = BitmapTextureAtlasTextureRegionFactory.createFromAsset(upperPipeTextureAtlas, activity, "pipeupper.png", 0, 0);
		upperPipeTextureAtlas.load();

		// upper pipe section	
		BitmapTextureAtlas upperPipeSectionTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 120, 1, TextureOptions.BILINEAR);
		mUpperPipeSectionTexture = BitmapTextureAtlasTextureRegionFactory.createFromAsset(upperPipeSectionTextureAtlas, activity, "pipesectionupper.png", 0, 0);
		upperPipeSectionTextureAtlas.load();


		// lower pipe		
		BitmapTextureAtlas lowerPipeTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 130, 60, TextureOptions.BILINEAR);
		mLowerPipeTexture = BitmapTextureAtlasTextureRegionFactory.createFromAsset(lowerPipeTextureAtlas, activity, "pipelower.png", 0, 0);
		lowerPipeTextureAtlas.load();

		// lower pipe section	
		BitmapTextureAtlas lowerPipeSectionTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 120, 1, TextureOptions.BILINEAR);
		mLowerPipeSectionTexture = BitmapTextureAtlasTextureRegionFactory.createFromAsset(lowerPipeSectionTextureAtlas, activity, "pipesectionlower.png", 0, 0);
		lowerPipeSectionTextureAtlas.load();
	}
 
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: WorldController.java    From tilt-game-android with MIT License 5 votes vote down vote up
private void createBackground(final Bitmap background, @Nullable final String backgroundUrl) {
    if (background == null) return;

    BitmapTextureAtlas bitmapTextureAtlas = new BitmapTextureAtlas(_engine.getTextureManager(), _width, _height, TextureOptions.BILINEAR);
    IBitmapTextureAtlasSource baseTextureSource = new EmptyBitmapTextureAtlasSource(_width, _height);

    final IBitmapTextureAtlasSource bitmapTextureAtlasSource = new BaseBitmapTextureAtlasSourceDecorator(baseTextureSource) {
        @Override
        protected void onDecorateBitmap(Canvas pCanvas) throws Exception {
            if (backgroundUrl != null) {
                Bitmap template = BitmapFactory.decodeStream(GoogleFlipGameApplication.sContext.getAssets().open(backgroundUrl));
                pCanvas.drawBitmap(template, 0, 0, mPaint);
            }

            pCanvas.drawColor(_backgroundColor);
            pCanvas.drawBitmap(background, 0, 0, mPaint);
        }

        @Override
        public BaseBitmapTextureAtlasSourceDecorator deepCopy() {
            throw new IModifier.DeepCopyNotSupportedException();
        }
    };

    ITextureRegion mDecoratedBalloonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromSource(bitmapTextureAtlas, bitmapTextureAtlasSource,
            0, 0);
    bitmapTextureAtlas.load();

    Sprite sprite = new Sprite(0, 0, mDecoratedBalloonTextureRegion, _engine.getVertexBufferObjectManager());
    sprite.setOffsetCenter(0, 0);
    sprite.setWidth(_width);
    sprite.setHeight(_height);
    _background = new SpriteBackground(sprite);
    _engine.getScene().setBackground(_background);
}
 
Example 5
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 6
Source File: ResourceLoader.java    From sopa with Apache License 2.0 5 votes vote down vote up
IFont getFont(final String name, float size, int color, float strokeWidth, int strokeColor) {

        FontFactory.setAssetBasePath("fonts/");

        final ITexture mainFontTexture = new BitmapTextureAtlas(textureManager, 1024, 1024, TextureOptions.BILINEAR);
        IFont font = FontFactory.createStrokeFromAsset(fontManager, mainFontTexture, assetManager, name, size, true,
                color, strokeWidth, strokeColor);
        font.load();

        return font;
    }