Esempio n. 1
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     if (this.isMouseDown)
     {
         exampleBase.MouseDrag(e.X, myHeight - e.Y);
         Invalidate();
     }
     base.OnMouseMove(e);
 }
Esempio n. 2
0
 protected override void OnMouseMove(UIMouseEventArgs e)
 {
     if (e.IsDragging)
     {
         _canvasRenderE.InvalidateGraphics();
         _exampleBase.MouseDrag(e.X, e.Y);
         _canvasRenderE.InvalidateGraphics();
     }
     base.OnMouseMove(e);
 }
Esempio n. 3
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     if (this.isMouseDown)
     {
         exampleBase.MouseDrag(e.X, myHeight - e.Y);
         if (!_useGdiPlusOutput)
         {
             Invalidate();
         }
         else
         {
             UpdateOutput();
         }
     }
     base.OnMouseMove(e);
 }
Esempio n. 4
0
        public void LoadExample(DemoBase demoBase)
        {
            _glControl.MakeCurrent();

            _demoBase = demoBase;
            demoBase.Init();

            if (WithGdiPlusDrawBoard)
            {
                _bridgeUI = new GdiOnGLESUIElement(_myWidth, _myHeight);
            }
            else
            {
                //pure agg's cpu blit
                _bridgeUI = new CpuBlitGLESUIElement(_myWidth, _myHeight);
            }
            //
            _bridgeUI.SetUpdateCpuBlitSurfaceDelegate((p, updateArea) => _demoBase.Draw(p));

            DemoBase.InvokePainterReady(_demoBase, _bridgeUI.GetAggPainter());
            //
            //use existing GLRenderSurface and GLPainter
            //see=>UISurfaceViewportControl.InitRootGraphics()

            GLPainterContext pcx       = _surfaceViewport.GetGLRenderSurface();
            GLPainter        glPainter = _surfaceViewport.GetGLPainter();

            _bridgeUI.CreatePrimaryRenderElement(pcx, glPainter, _rootGfx);
            //-----------------------------------------------
            demoBase.SetEssentialGLHandlers(
                () => _glControl.SwapBuffers(),
                () => _glControl.GetEglDisplay(),
                () => _glControl.GetEglSurface()
                );
            //-----------------------------------------------
            DemoBase.InvokeGLPainterReady(demoBase, pcx, glPainter);
            //Add to RenderTree
            _rootGfx.AddChild(_bridgeUI.GetPrimaryRenderElement(_rootGfx));
            //-----------------------------------------------
            //***
            GeneralEventListener genEvListener = new GeneralEventListener();

            genEvListener.MouseDown += e =>
            {
                _demoBase.MouseDown(e.X, e.Y, e.Button == UIMouseButtons.Right);
                _bridgeUI.InvalidateGraphics();
            };
            genEvListener.MouseMove += e =>
            {
                if (e.IsDragging)
                {
                    _bridgeUI.InvalidateGraphics();
                    _demoBase.MouseDrag(e.X, e.Y);
                    _bridgeUI.InvalidateGraphics();
                }
            };
            genEvListener.MouseUp += e =>
            {
                _demoBase.MouseUp(e.X, e.Y);
            };
            //-----------------------------------------------
            _bridgeUI.AttachExternalEventListener(genEvListener);
        }