2

Possible Duplicate:
android live wallpaper rescaling
AndEngine Live wallpaper preview Bug?

I am developing a live wallpaper using AndEngine. The problem is when i preview th wallpaper in portrait mode it works fine, but when rotate the wallpaper to landscape mode the wallpaper becomes weird. Worse, being in portrait mode when I set the wallpaper and after going to home screen I rotate the tablet to landscape mode it works fine.

Here is the onConfigurationChanged() function code.

@Override
public void onConfigurationChanged (Configuration newConfig){
if(newConfig.orientation == Configuration.ORIENTATION_PORTRAIT)
    {
        mScene.setScale(1);
        mScene.setPosition(mSceneX,mSceneY);
        //scene.setBackground(sb);
    }
    else if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
    {
        Log.d("conf", "conf");
        mSceneX=mScene.getX();
        mSceneY=mScene.getY();
        mScene.setScaleY(1330f/790f);
        mScene.setScaleX(790f/1330f);

        mScene.setPosition(mScene.getX()+getX(160f),mScene.getY()-getY(420));
        //scene.setBackground(sb2);
    }
}
Community
  • 1
  • 1
Usman Iftakhar
  • 278
  • 5
  • 17

0 Answers0