Display 顯示
class in UnityEngine
Description 描述
Provides access to a display / screen for rendering operations.
提供顯示器或者屏幕渲染操作的接口。
This feature is available for iPhone.
此功能可用於iPhone。
JavaScript:
void Start()
{
// GUI is rendered with last camera.
// As we want it to end up in the main screen, make sure main camera is the last one drawn.
extCam.depth = camera.depth - 1;
camera.SetTargetBuffers(Display.main.colorBuffer, Display.main.depthBuffer);
extCam.enabled = false;
}
void Update()
{
if(Display.displays.Length > 1 && !extCam.enabled)
{
Display.displays[1].SetRenderingResolution(256,256);
extCam.SetTargetBuffers(Display.displays[1].colorBuffer, Display.displays[1].depthBuffer);
}
extCam.enabled = Display.displays.Length > 1;
}
C#:
void Start()
{
// GUI is rendered with last camera.
// As we want it to end up in the main screen, make sure main camera is the last one drawn.
extCam.depth = camera.depth - 1;
camera.SetTargetBuffers(Display.main.colorBuffer, Display.main.depthBuffer);
extCam.enabled = false;
}
void Update()
{
if(Display.displays.Length > 1 && !extCam.enabled)
{
Display.displays[1].SetRenderingResolution(256,256);
extCam.SetTargetBuffers(Display.displays[1].colorBuffer, Display.displays[1].depthBuffer);
}
extCam.enabled = Display.displays.Length > 1;
}
Static Variables 靜態變量
displays The list of currently connected Displays. Contains at least one (main) display.
當前連接的顯示器的列表。至少包含一個主顯示器。 main Main Display.
主顯示器。
Variables 變量
colorBuffer Color RenderBuffer.
顏色緩衝。 depthBuffer Depth RenderBuffer.
深度緩衝。 renderingHeight Rendering Height.
渲染高度。 renderingWidth Rendering Width.
渲染寬度。 systemHeight System Height.
系統高度。 systemWidth System Width.
系統寬度。
Public Functions 公共函數
Activate Activate an external display. Eg. Secondary Monitors connected to the System.
激活外部顯示。如:二級監控系統連接到該系統。 SetParams This Windows only function can be used to set Size and Position of the Screen when Multi-Display is enabled.
當Multi-Display啟用時,該函數僅windows可用設置屏幕大小和位置。 SetRenderingResolution Sets Rendering resolution for the display.
設置顯示器的渲染像素。
Static Functions 靜態函數
RelativeMouseAt Query relative mouse coordinates.
查詢相對的鼠標位置座標。
閱讀更多 夢牽魂之淚痕 的文章
關鍵字: 顯示器 Unity引擎 JavaScript