本文整理汇总了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);
}
示例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);
}