当前位置: 首页>>代码示例>>Java>>正文


Java EmptyBitmapTextureAtlasSource类代码示例

本文整理汇总了Java中org.andengine.opengl.texture.atlas.bitmap.source.EmptyBitmapTextureAtlasSource的典型用法代码示例。如果您正苦于以下问题:Java EmptyBitmapTextureAtlasSource类的具体用法?Java EmptyBitmapTextureAtlasSource怎么用?Java EmptyBitmapTextureAtlasSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EmptyBitmapTextureAtlasSource类属于org.andengine.opengl.texture.atlas.bitmap.source包,在下文中一共展示了EmptyBitmapTextureAtlasSource类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createBackground

import org.andengine.opengl.texture.atlas.bitmap.source.EmptyBitmapTextureAtlasSource; //导入依赖的package包/类
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);
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:36,代码来源:WorldController.java

示例2: addEmptyTextureAtlasSource

import org.andengine.opengl.texture.atlas.bitmap.source.EmptyBitmapTextureAtlasSource; //导入依赖的package包/类
@Override
public void addEmptyTextureAtlasSource(final int pTextureX, final int pTextureY, final int pWidth, final int pHeight) {
	this.addTextureAtlasSource(new EmptyBitmapTextureAtlasSource(pWidth, pHeight), pTextureX, pTextureY);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:5,代码来源:BitmapTextureAtlas.java


注:本文中的org.andengine.opengl.texture.atlas.bitmap.source.EmptyBitmapTextureAtlasSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。