Exemplo n.º 1
0
        public GraphicsProviderImpl(int updateTickMS = 100, string canvasDivName = "AnyGUIDiv")
        {
            mgr = new CanvasManager();
            mgr.SetDiv(canvasDivName);
            mgr.MouseDownListeners += delegate(object ctxt, int buttonNum) {
                if (_mouseDownListeners != null)
                {
                    _mouseDownListeners(buttonNum);
                }
            };
            mgr.MouseUpListeners += delegate(object ctxt, int buttonNum) {
                if (buttonNum == 0)
                {
                    CurrentlyHeldObject = null;
                }
                if (_mouseUpListeners != null)
                {
                    _mouseUpListeners(buttonNum);
                }
            };
            mgr.MouseMoveListeners += delegate(object ctxt, Vector2 <float> pos) {
                if (CurrentlyHeldObject != null)
                {
                    CurrentlyHeldObject.DoDrag(new Vector2 <float>(pos.X, pos.Y) - lastMousePos);
                }
                if (_mouseMoveListeners != null)
                {
                    _mouseMoveListeners(pos);
                }
                lastMousePos = pos;
            };
            mgr.MouseScrollListeners += delegate(object ctxt, int wheeldelta) {
                if (_mouseScrollListeners != null)
                {
                    _mouseScrollListeners(wheeldelta);
                }
            };

            /*mgr.TickListeners += delegate(long deltaMS) {
             *      if (TickListeners!=null){
             *              TickListeners(deltaMS);
             *      }
             * };*/
            mgr.SetAnimTick(updateTickMS);
        }
Exemplo n.º 2
0
 public FontImpl(CanvasManager cmgr, string fontname = "24px Arial")
 {
     Name = fontname;
     mgr  = cmgr;
 }