コード例 #1
0
        /// <summary>
        /// 创建viewport窗口,因为创建窗口即刻需要渲染(Paint事件),所以独立成一个函数,在引擎和level创建后才调用。
        /// </summary>
        public void CreateViewport()
        {
            AutoViewportSize();

            List <NEMainViewport> vpList = new List <NEMainViewport>();
            NEMainViewport        vp1    = new NEMainViewport();

            vp1.SetCameraMode(EditorCameraMode.Top);
            this.splitContainerViewUp.Panel1.Controls.Add(vp1);
            vpList.Add(vp1);

            NEMainViewport vp2 = new NEMainViewport();

            vp2.SetCameraMode(EditorCameraMode.Front);
            this.splitContainerViewUp.Panel2.Controls.Add(vp2);
            vpList.Add(vp2);

            NEMainViewport vp3 = new NEMainViewport();

            vp3.SetCameraMode(EditorCameraMode.Side);
            this.splitContainerViewDown.Panel1.Controls.Add(vp3);
            vpList.Add(vp3);

            NEMainViewport vp4 = new NEMainViewport();

            vp4.SetCameraMode(EditorCameraMode.Perspective);
            this.splitContainerViewDown.Panel2.Controls.Add(vp4);
            vpList.Add(vp4);

            NLevelEditorEngine.Instance.ActorEd.ActorSelected
                += new EventHandler(this.ActorSelectedHandler);

            //--
            m_viewports = vpList;
            foreach (NEMainViewport vp in m_viewports)
            {
                vp.DoubleClick += new EventHandler(viewport_DoubleClick);
                vp.MouseClick  += this.viewport_MouseClick;
                vp.CameraOperateFactorChangeEvent += this.OnCameraOperateFactorChange;
            }

            if (m_viewports.Count > 0)
            {
                statusMainForm.Items[2].Text = "摄像机正常速度";
            }
        }