Esempio n. 1
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);
        }
        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;
        }
Esempio n. 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);
        }
        // ===========================================================
        // 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;
        }
Esempio n. 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);
        }
Esempio n. 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);
 }
Esempio n. 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);
 }
Esempio n. 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);
        }
Esempio n. 9
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);
 }
Esempio n. 10
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);
 }