用户工具

站点工具


侧边栏



Unity3D中文文档

script:unityengine:classes:display:display

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 静态变量

displaysThe list of currently connected Displays. Contains at least one (main) display.
当前连接的显示器的列表。至少包含一个主显示器。
mainMain Display.
主显示器。

Variables 变量

colorBufferColor RenderBuffer.
颜色缓冲。
depthBufferDepth RenderBuffer.
深度缓冲。
renderingHeightRendering Height.
渲染高度。
renderingWidthRendering Width.
渲染宽度。
systemHeightSystem Height.
系统高度。
systemWidthSystem Width.
系统宽度。

Public Functions 公共函数

ActivateActivate an external display. Eg. Secondary Monitors connected to the System.
激活外部显示。如:二级监控系统连接到该系统。
SetParamsThis Windows only function can be used to set Size and Position of the Screen when Multi-Display is enabled.
当Multi-Display启用时,该函数仅windows可用设置屏幕大小和位置。
SetRenderingResolutionSets Rendering resolution for the display.
设置显示器的渲染像素。

Static Functions 静态函数

RelativeMouseAtQuery relative mouse coordinates.
查询相对的鼠标位置坐标。
script/unityengine/classes/display/display.txt · 最后更改: 2016/08/02 05:35 (外部编辑)