Vector4 Viewport { get; set; }

robot_2Generated
code_blocksInput

Description

The Viewport property of the CameraComponent class represents the size of the camera as it is displayed on the screen. The values are normalized between 0 and 1, where 0 represents the minimum size and 1 represents the maximum size. This property is useful for defining the portion of the screen that the camera view should occupy.

Usage

To set the Viewport property, assign a Vector4 value where each component is a float between 0 and 1. The components represent the x and y position of the viewport's bottom-left corner, and the width and height of the viewport, respectively.

For example, setting the viewport to new Vector4(0, 0, 0.5f, 0.5f) will make the camera view occupy the bottom-left quarter of the screen.

Example

// Example of setting the Viewport property
CameraComponent camera = new CameraComponent();
camera.Viewport = new Vector4(0, 0, 0.5f, 0.5f); // Sets the camera to occupy the bottom-left quarter of the screen