Ejemplo n.º 1
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            this.isMouseDown = true;

            exampleBase.MouseDown(e.X, myHeight - e.Y, e.Button == System.Windows.Forms.MouseButtons.Right);
            base.OnMouseDown(e);
            Invalidate();
        }
Ejemplo n.º 2
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     this.isMouseDown = true;
     exampleBase.MouseDown(e.X, myHeight - e.Y, e.Button == System.Windows.Forms.MouseButtons.Right);
     base.OnMouseDown(e);
     if (!_useGdiPlusOutput)
     {
         Invalidate();
     }
     else
     {
         UpdateOutput();
     }
 }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 //handle event
 protected override void OnMouseDown(UIMouseEventArgs e)
 {
     _exampleBase.MouseDown(e.X, e.Y, e.Button == UIMouseButtons.Right);
     base.OnMouseDown(e);
 }
Ejemplo n.º 5
0
 //handle event
 protected override void OnMouseDown(UIMouseDownEventArgs e)
 {
     _demoBase.MouseDown(e.X, e.Y, e.Buttons == UIMouseButtons.Right);
     base.OnMouseDown(e);
 }