コード例 #1
0
ファイル: CameraScene.cs プロジェクト: slagusev/AndEngine.net
        // ===========================================================
        // Methods
        // ===========================================================

        public void CenterShapeInCamera(Shape pShape)
        {
            Camera camera = this.mCamera;

            //pShape.setPosition((camera.getWidth() - pShape.getWidth()) * 0.5f, (camera.getHeight() - pShape.getHeight()) * 0.5f);
            pShape.SetPosition((camera.Width - pShape.GetWidth()) * 0.5f, (camera.Height - pShape.GetHeight()) * 0.5f);
        }
コード例 #2
0
        public static float[] ConvertLocalToSceneCoordinates(/* final */ Shape pShape, /* final */ float pX, /* final */ float pY)
        {
            VERTICES_LOCAL_TO_SCENE_TMP[Constants.VERTEX_INDEX_X] = pX;
            VERTICES_LOCAL_TO_SCENE_TMP[Constants.VERTEX_INDEX_Y] = pY;

            MathUtils.RotateAndScaleAroundCenter(VERTICES_LOCAL_TO_SCENE_TMP,
                    pShape.GetRotation(), pShape.GetRotationCenterX(), pShape.GetRotationCenterY(),
                    pShape.GetScaleX(), pShape.GetScaleY(), pShape.GetScaleCenterX(), pShape.GetScaleCenterY());

            return VERTICES_LOCAL_TO_SCENE_TMP;
        }
コード例 #3
0
        public static float[] ConvertLocalToSceneCoordinates(/* final */ Shape pShape, /* final */ float pX, /* final */ float pY)
        {
            VERTICES_LOCAL_TO_SCENE_TMP[Constants.VERTEX_INDEX_X] = pX;
            VERTICES_LOCAL_TO_SCENE_TMP[Constants.VERTEX_INDEX_Y] = pY;

            MathUtils.RotateAndScaleAroundCenter(VERTICES_LOCAL_TO_SCENE_TMP,
                                                 pShape.GetRotation(), pShape.GetRotationCenterX(), pShape.GetRotationCenterY(),
                                                 pShape.GetScaleX(), pShape.GetScaleY(), pShape.GetScaleCenterX(), pShape.GetScaleCenterY());

            return(VERTICES_LOCAL_TO_SCENE_TMP);
        }
コード例 #4
0
        // ===========================================================
        // Fields
        // ===========================================================

        // ===========================================================
        // Constructors
        // ===========================================================

        // ===========================================================
        // Getter & Setter
        // ===========================================================

        // ===========================================================
        // Methods for/from SuperClass/Interfaces
        // ===========================================================

        // ===========================================================
        // Methods
        // ===========================================================

        public static float[] ConvertSceneToLocalCoordinates(/* final */ Shape pShape, /* final */ float pX, /* final */ float pY)
        {
            VERTICES_SCENE_TO_LOCAL_TMP[Constants.VERTEX_INDEX_X] = pX;
            VERTICES_SCENE_TO_LOCAL_TMP[Constants.VERTEX_INDEX_Y] = pY;

            /* final */
            float left = pShape.GetX();
            /* final */
            float top = pShape.GetY();

            MathUtils.RevertRotateAndScaleAroundCenter(VERTICES_SCENE_TO_LOCAL_TMP,
                    pShape.GetRotation(), left + pShape.GetRotationCenterX(), top + pShape.GetRotationCenterY(),
                    pShape.GetScaleX(), pShape.GetScaleY(), left + pShape.GetScaleCenterX(), top + pShape.GetScaleCenterY());

            return VERTICES_SCENE_TO_LOCAL_TMP;
        }
コード例 #5
0
        // ===========================================================
        // Fields
        // ===========================================================

        // ===========================================================
        // Constructors
        // ===========================================================

        // ===========================================================
        // Getter & Setter
        // ===========================================================

        // ===========================================================
        // Methods for/from SuperClass/Interfaces
        // ===========================================================

        // ===========================================================
        // Methods
        // ===========================================================

        public static float[] ConvertSceneToLocalCoordinates(/* final */ Shape pShape, /* final */ float pX, /* final */ float pY)
        {
            VERTICES_SCENE_TO_LOCAL_TMP[Constants.VERTEX_INDEX_X] = pX;
            VERTICES_SCENE_TO_LOCAL_TMP[Constants.VERTEX_INDEX_Y] = pY;

            /* final */
            float left = pShape.GetX();
            /* final */
            float top = pShape.GetY();

            MathUtils.RevertRotateAndScaleAroundCenter(VERTICES_SCENE_TO_LOCAL_TMP,
                                                       pShape.GetRotation(), left + pShape.GetRotationCenterX(), top + pShape.GetRotationCenterY(),
                                                       pShape.GetScaleX(), pShape.GetScaleY(), left + pShape.GetScaleCenterX(), top + pShape.GetScaleCenterY());

            return(VERTICES_SCENE_TO_LOCAL_TMP);
        }
コード例 #6
0
 public void centerShapeInCameraVertically(Shape pShape)
 {
     //pShape.setPosition(pShape.getX(), (this.mCamera.getHeight() - pShape.getHeight()) * 0.5f);
     pShape.SetPosition(pShape.X, (this.mCamera.Height - pShape.GetHeight()) * 0.5f);
     pShape.SetPosition(pShape.X, (this.mCamera.Height - pShape.GetHeight()) * 0.5f);
 }
コード例 #7
0
 public void centerShapeInCameraHorizontally(Shape pShape)
 {
     //pShape.setPosition((this.mCamera.getWidth() - pShape.getWidth()) * 0.5f, pShape.getY());
     pShape.SetPosition((this.mCamera.Width - pShape.GetWidth()) * 0.5f, pShape.Y);
 }
コード例 #8
0
        // ===========================================================
        // Methods
        // ===========================================================

        public void CenterShapeInCamera(Shape pShape)
        {
            Camera camera = this.mCamera;
            //pShape.setPosition((camera.getWidth() - pShape.getWidth()) * 0.5f, (camera.getHeight() - pShape.getHeight()) * 0.5f);
            pShape.SetPosition((camera.Width - pShape.GetWidth()) * 0.5f, (camera.Height - pShape.GetHeight()) * 0.5f);
        }
コード例 #9
0
ファイル: CameraScene.cs プロジェクト: slagusev/AndEngine.net
 public void centerShapeInCameraVertically(Shape pShape)
 {
     //pShape.setPosition(pShape.getX(), (this.mCamera.getHeight() - pShape.getHeight()) * 0.5f);
     pShape.SetPosition(pShape.X, (this.mCamera.Height - pShape.GetHeight()) * 0.5f);
     pShape.SetPosition(pShape.X, (this.mCamera.Height - pShape.GetHeight()) * 0.5f);
 }
コード例 #10
0
ファイル: CameraScene.cs プロジェクト: slagusev/AndEngine.net
 public void centerShapeInCameraHorizontally(Shape pShape)
 {
     //pShape.setPosition((this.mCamera.getWidth() - pShape.getWidth()) * 0.5f, pShape.getY());
     pShape.SetPosition((this.mCamera.Width - pShape.GetWidth()) * 0.5f, pShape.Y);
 }