tk2dEditor.tk2dCameraSceneGUI.PreviewWindowFunc C# (CSharp) Method

PreviewWindowFunc() private method

private PreviewWindowFunc ( int windowId ) : void
windowId int
return void
        void PreviewWindowFunc(int windowId)
        {
            GUILayout.BeginVertical();
            Rect rs = GUILayoutUtility.GetRect(1.0f, 1.0f, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

            switch (Event.current.type)
            {
                case EventType.Repaint:
                {
                    int heightTweak = 19;
                    Rect r = new Rect(previewWindowRect.x + rs.x, Camera.current.pixelHeight - (previewWindowRect.y + rs.y), rs.width, rs.height);
                    Vector2 v = new Vector2(previewWindowRect.x + rs.x, (Camera.current.pixelHeight - previewWindowRect.y - rs.height - heightTweak) + rs.y);
                    previewCamera.CopyFrom(target.camera);
                    previewCamera.projectionMatrix = target.camera.projectionMatrix; // Work around a Unity bug
                    previewCamera.pixelRect = new Rect(v.x, v.y, r.width, r.height);
                    previewCamera.Render();
                    break;
                }
            }

            GUILayout.EndVertical();
        }