我是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 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
}
}
我在谷歌上搜索并尝试了我发现但没有成功的东西