예제 #1
0
        protected override void OnEndFrame()
        {
            mGraphics.Dispose();
            mGraphics = null;

            Drawing_FrameBuffer renderTarget = RenderTarget.Impl as Drawing_FrameBuffer;

            renderTarget.EndRender();
            mInFrame = false;
        }
예제 #2
0
        protected override void OnRenderTargetChange(FrameBuffer oldRenderTarget)
        {
            if (mInFrame)
            {
                throw new AgateException(
                          "Cannot change the current render target inside BeginFrame..EndFrame block!");
            }

            System.Diagnostics.Debug.Assert(mGraphics == null);

            mRenderTarget = RenderTarget.Impl as Drawing_FrameBuffer;

            OnRenderTargetResize();
        }
예제 #3
0
        public Drawing_DisplayWindow(DisplayWindow owner, CreateWindowParams windowParams)
        {
            mOwner = owner;

            if (windowParams.RenderToControl == true)
            {
                if (typeof(Control).IsAssignableFrom(windowParams.RenderTarget.GetType()) == false)
                {
                    throw new AgateException(string.Format("The specified render target is of type {0}, " +
                                                           "which does not derive from System.Windows.Forms.Control.", windowParams.RenderTarget.GetType().Name));
                }

                mRenderTarget = (Control)windowParams.RenderTarget;

                AttachEvents();

                RecreateBackBuffer();
            }
            else
            {
                AgateLib.WinForms.FormUtil.InitializeWindowsForm(out frm, out mRenderTarget, windowParams.WindowPosition, windowParams.Title,
                                                                 windowParams.Width, windowParams.Height, windowParams.IsFullScreen, windowParams.IsResizable,
                                                                 windowParams.HasFrame);

                if (string.IsNullOrEmpty(windowParams.IconFile) == false)
                {
                    mIcon    = new Icon(windowParams.IconFile);
                    frm.Icon = mIcon;
                }

                // finally, show the form
                frm.Show();

                AttachEvents();

                // and create the back buffer
                RecreateBackBuffer();
            }

            mFrameBuffer = new Drawing_FrameBuffer(mBackBuffer);
            mFrameBuffer.EndRenderEvent += new EventHandler(mFrameBuffer_EndRenderEvent);
            mFrameBuffer.mAttachedWindow = mOwner;
        }