0

I have been using RatioResolutionPolicy and now trying to switch to FillResolutionPolicy. But whenever I setRotation() of a sprite, it get's skewed at some angle depending on the angle of rotation. I have inspected the andengine source for applyRotation() in the Entity class and this is it. Is there anything I can do to avoid skewing of my sprites?

protected void applyRotation(final GL10 pGL) { final float rotation = this.mRotation;

    if(rotation != 0) {
        final float rotationCenterX = this.mRotationCenterX;
        final float rotationCenterY = this.mRotationCenterY;

        pGL.glTranslatef(rotationCenterX, rotationCenterY, 0);
        pGL.glRotatef(rotation, 0, 0, 1);
        pGL.glTranslatef(-rotationCenterX, -rotationCenterY, 0);
    }
}
  • a FillResolutionPolicy would tend to do that since it will have to stretch the image in one axis (by the same amount the scene is stretched) to make things fit. You're probably better off with the RatioResolutionPolicy. What prompted you to make the switch anyway? – jmroyalty Mar 24 '14 at 20:29
  • Thanks... I know why a FillResolution does that but I switched to it because it manages the screen more easily compared to the RatioResolution Policy which gives me black spots on some screen resolutions. Is there a way I can override the onDraw call for a particular sprite and set a different rule for drawing it and avoid skewing? – Zed Jasper Onono Mar 24 '14 at 22:25
  • I don't think there is a perfect solution to this - it's been discussed many times. One popular idea is to use a RatioResolutionPolicy but adjust based on the screen's ratio - similar to what is discussed at the bottom of this question - http://stackoverflow.com/questions/11399045/sprite-size-on-different-screen-size-andengine-android – jmroyalty Mar 24 '14 at 23:32

1 Answers1

0

Maybe you should try different ResolutionPolicy, like custom CropResolutionPolicy. Look some examples of using this, maybe it helps AndEngine ResolutionPolicy

  • yeah, I switched back to RatioResolutionPolicy, I will just deal with a few issues manually – Zed Jasper Onono Mar 29 '14 at 13:30
  • I tried another resolution policy created by Martin, the source is here https://github.com/sm4/AndEngine/blob/GLES2-AnchorCenter/src/org/andengine/engine/options/resolutionpolicy/CropResolutionPolicy.java – Zed Jasper Onono Apr 14 '14 at 15:07
  • i wrote you about it, very nice policy. you can set HUD depending on screen edge, not depending on pixels. – user3470643 Apr 14 '14 at 21:57