FlatRedBall.Camera.UsePixelCoordinates C# (CSharp) Method

UsePixelCoordinates() public method

Sets the camera to Orthogonal, sets the OrthogonalWidth and OrthogonalHeight to match the argument values, and can move the so the bottom-left corner of the screen is at the origin.
public UsePixelCoordinates ( bool moveCornerToOrigin, int desiredWidth, int desiredHeight ) : void
moveCornerToOrigin bool Whether the camera should be repositioned /// so the bottom left is at the origin.
desiredWidth int The desired unit width of the view.
desiredHeight int The desired unit height of the view.
return void
        public void UsePixelCoordinates(bool moveCornerToOrigin, int desiredWidth, int desiredHeight)
        {
            this.Orthogonal = true;
            OrthogonalWidth = desiredWidth;
            OrthogonalHeight = desiredHeight;

            if (moveCornerToOrigin)
            {
                X = OrthogonalWidth / 2.0f;
                Y = OrthogonalHeight / 2.0f;
            }
        }

Usage Example

示例#1
0
 internal static void SetupCamera(Camera cameraToSetUp, GraphicsDeviceManager graphicsDeviceManager)
 {
     #if !WINDOWS_PHONE
     FlatRedBallServices.GraphicsOptions.SetResolution(800, 600);
     #else
     graphicsDeviceManager.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
     #endif
     cameraToSetUp.UsePixelCoordinates(false, 800, 600);
 }
All Usage Examples Of FlatRedBall.Camera::UsePixelCoordinates