android和Engine png图像闪烁
我是andengine游戏开发的新手,我在场景中添加了一个png图像,它显示在应用程序中,但它在闪烁我不知道为什么,请帮助我,提前谢谢 这是我的密码:android和Engine png图像闪烁,android,png,andengine,Android,Png,Andengine,我是andengine游戏开发的新手,我在场景中添加了一个png图像,它显示在应用程序中,但它在闪烁我不知道为什么,请帮助我,提前谢谢 这是我的密码: public static final int WIDTH = 800; public static final int HEIGHT = 480; private static final int DEFAULT_IMAGE_ROTATION = 90; private Scene mScene; private Camera mCamer
public static final int WIDTH = 800;
public static final int HEIGHT = 480;
private static final int DEFAULT_IMAGE_ROTATION = 90;
private Scene mScene;
private Camera mCamera;
private Sprite mArrowSprite;
private Sprite mMarbleSprite;
private ITextureRegion mArrowTextureRegion;
private ITextureRegion mMarbleTextureRegion;
BitmapTextureAtlas playerTexture;
@Override
public EngineOptions onCreateEngineOptions()
{
// TODO Auto-generated method stub
mCamera = new Camera(0, 0, WIDTH, HEIGHT);
final FixedStepEngine engine = new FixedStepEngine(new EngineOptions(true,
ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(
WIDTH, HEIGHT), mCamera),60);
//EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(), mCamera);
//engineOptions.getRenderOptions().setDithering(false);
//return engineOptions;
return engine.getEngineOptions();
}
@Override
public void onCreateResources(
OnCreateResourcesCallback pOnCreateResourcesCallback)
throws IOException
{
// TODO Auto-generated method stub
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
BuildableBitmapTextureAtlas mBitmapTextureAtlas = new BuildableBitmapTextureAtlas(mEngine.getTextureManager(), 128, 128, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
mArrowTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(mBitmapTextureAtlas, this, "player.png");
//mMarbleTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(mBitmapTextureAtlas, this, "marble.png");
try
{
mBitmapTextureAtlas.build(new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 0, 1));
}
catch (TextureAtlasBuilderException e)
{
e.printStackTrace();
}
mBitmapTextureAtlas.load();
this.mEngine.getTextureManager().loadTexture(mBitmapTextureAtlas);
pOnCreateResourcesCallback.onCreateResourcesFinished();
}
@Override
public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback)
throws IOException
{
// TODO Auto-generated method stub
mScene = new Scene();
mScene.setOnSceneTouchListener(this);
}
@Override
public void onPopulateScene(Scene pScene,
OnPopulateSceneCallback pOnPopulateSceneCallback)
throws IOException
{
// TODO Auto-generated method stub
}
公共静态最终整数宽度=800;
公共静态最终内部高度=480;
私有静态最终整数默认图像旋转=90;
私密场景;
私人摄像机麦卡梅拉;
私人雪碧玛洛斯普林特;
私人雪碧;
马里洛纹理区域私人信息网注册;
私有ITextureRegion mMarbleTextureRegion;
BitmapTextureAtlas playerTexture;
@凌驾
public EngineOptions onCreateEngineOptions()
{
//TODO自动生成的方法存根
mCamera=新相机(0,0,宽度,高度);
最终固定步骤发动机=新固定步骤发动机(新发动机选项(true,
ScreenOrientation.scape\u固定、新比率解决方案策略(
宽度、高度),mCamera),60);
//EngineOptions EngineOptions=新的EngineOptions(true,ScreenOrientation.scape\u已修复,新的FillResolutionPolicy(),mCamera);
//engineOptions.getRenderOptions().Set抖动(false);
//返回引擎选项;
return engine.getEngineOptions();
}
@凌驾
公共资源(
OnCreateResourcesCallback pOnCreateResourcesCallback)
抛出IOException
{
//TODO自动生成的方法存根
BitmapTextureLastTextureRegionFactory.setAssetBasePath(“gfx/”);
BuildableBitmapTextureAtlas mBitmapTextureAtlas=新的BuildableBitmapTextureAtlas(mEngine.getTextureManager(),128,128,TextureOptions.BILINEAR\u PREMULTIPLYALPHA);
mArrowTextureRegion=BitmapTextureAtlastTextureRegionFactory.createFromAsset(mbitmPtextureAtlas,此为“player.png”);
//mMarbleTextureRegion=BitmapTextureAtlasTextureRegionFactory.createFromAsset(mBitmapTextureAtlas,此为“marble.png”);
尝试
{
mBitmapTextureAtlas.build(新的BlackPawnTextureAtlasBuilder(0,0,1));
}
捕捉(纹理LasBuilderException e)
{
e、 printStackTrace();
}
mbitmaptexturetalas.load();
this.mEngine.getTextureManager().loadTexture(mBitmapTextureAtlas);
ponCreateResourcesScallback.onCreateResourcesFinished();
}
@凌驾
public void OnCreateSceneCallback(OnCreateSceneCallback-pOnCreateSceneCallback)
抛出IOException
{
//TODO自动生成的方法存根
mScene=新场景();
mScene.setOnSceneTouchListener(此);
}
@凌驾
在PopulateScene(场景pScene,
OnPopulateSceneCallback PopulateSceneCallback)
抛出IOException
{
//TODO自动生成的方法存根
}
}
我在谷歌上搜索并尝试了我找到的东西,但没有成功,直到你有效地调用了
mBitmapTextureAtlas.load()
两次。那可能是个问题
128x128
是否足够容纳player.png
另外,闪烁也不是一个非常精确的问题描述=p您没有包括将实体添加到场景中的代码部分。请定义“闪烁”。。。