Esempio n. 1
0
        public HwndHostInputProvider(GraphicsDeviceControl uiElement)
        {
            _uiElement = uiElement;
            _uiElement.HwndMouseEnter += OnHwndMouseEnter;

            _inputMapper = new HwndHostInputMapper(uiElement);
        }
Esempio n. 2
0
        public Integrator(GraphicsDeviceControl control)
        {
            this.control = control;

            //fixedTimeStep = (float)game.TargetElapsedTime.TotalSeconds;
            fixedTimeStep = 0.01f;
        }
Esempio n. 3
0
 public AssetHandlers(ContentManager contentManager, GraphicsDeviceControl graphicsDeviceControl)
 {
     _graphicsDeviceControl = graphicsDeviceControl;
     _modelHandler          = new ModelHandler(contentManager, graphicsDeviceControl);
     _effectHandler         = new EffectHandler(contentManager, graphicsDeviceControl);
     _textureHandler        = new TextureHandler(contentManager, graphicsDeviceControl);
 }
        public void OnWindowSizeChanged(GraphicsDeviceControl control)
        {
            var clientSize = control.ClientSize;

            if (clientSize.Width <= 0 || clientSize.Height <= 0)
            {
                return;
            }

            _chain?.Dispose();

            var graphicsDevice = control.GraphicsDevice;

            if (graphicsDevice != null)
            {
                _chain = new SwapChainRenderTarget(graphicsDevice, control.Handle, clientSize.Width, clientSize.Height);

                graphicsDevice.PresentationParameters.BackBufferWidth  = clientSize.Width;
                graphicsDevice.PresentationParameters.BackBufferHeight = clientSize.Height;

                graphicsDevice.Viewport = new Viewport(0, 0, clientSize.Width, clientSize.Height, 0, 1);
            }

            if (_chain != null)
            {
                SwapChainUpdated?.Invoke(this, new SwapChainUpdatedEventArgs(_chain));
            }
        }
        public void PrepareDraw(GraphicsDeviceControl control, PresentationParameters presentationParameters)
        {
            if (control.IsDesignMode)
            {
                return;
            }

            _presentationParameters = presentationParameters;
        }
Esempio n. 6
0
 public void Initialize(GraphicsDeviceControl graphicsDeviceControl, PreviewControls previewControls)
 {
     mPreviewControls = previewControls;
     mPreviewControls.OnionSkinVisibleChange += new EventHandler(HandleOnionSkinChange);
     mPreviewControls.SpriteAlignmentChange  += new EventHandler(HandleSpriteAlignmentChange);
     mControl             = graphicsDeviceControl;
     mControl.XnaDraw    += new Action(HandleXnaDraw);
     mControl.MouseWheel += new System.Windows.Forms.MouseEventHandler(HandleMouseWheel);
     HandleXnaInitialize();
 }
        public void BeginDraw(GraphicsDeviceControl control)
        {
            if (control.IsDesignMode)
            {
                return;
            }

            var graphicsDevice = control.GraphicsDevice;

            graphicsDevice?.SetRenderTarget(_chain);
        }
Esempio n. 8
0
        public CameraPanningLogic(GraphicsDeviceControl graphicsControl, SystemManagers managers, Cursor cursor, Keyboard keyboard)
        {
            mManagers = managers;

            mKeyboard = keyboard;

            mCursor = cursor;
            mCursor.Initialize(graphicsControl);
            mCamera  = managers.Renderer.Camera;
            mControl = graphicsControl;
            graphicsControl.XnaUpdate += new Action(Activity);
        }
        public void Initialize(GraphicsDeviceControl control)
        {
            if (control.IsDesignMode)
            {
                return;
            }

            var clientSize = control.ClientSize;

            var width  = Math.Max(clientSize.Width, 1);
            var height = Math.Max(clientSize.Height, 1);

            _chain = new SwapChainRenderTarget(control.GraphicsDevice, control.Handle, width, height);
        }
Esempio n. 10
0
        public HwndHostInputMapper(GraphicsDeviceControl hwndHost)
            : base(hwndHost)
        {
            _hwndHost = hwndHost;

            _hwndHost.HwndMouseMove    += HandleMouseEvent;
            _hwndHost.HwndMouseWheel   += HandleMouseEvent;
            _hwndHost.HwndLButtonDown  += HandleMouseEvent;
            _hwndHost.HwndLButtonUp    += HandleMouseEvent;
            _hwndHost.HwndRButtonDown  += HandleMouseEvent;
            _hwndHost.HwndRButtonUp    += HandleMouseEvent;
            _hwndHost.HwndMButtonDown  += HandleMouseEvent;
            _hwndHost.HwndMButtonUp    += HandleMouseEvent;
            _hwndHost.HwndX1ButtonDown += HandleMouseEvent;
            _hwndHost.HwndX1ButtonUp   += HandleMouseEvent;
            _hwndHost.HwndX2ButtonDown += HandleMouseEvent;
            _hwndHost.HwndX2ButtonUp   += HandleMouseEvent;
        }
Esempio n. 11
0
        public Ruler(GraphicsDeviceControl control, SystemManagers managers, Cursor cursor)
        {
            try
            {
                mControl  = control;
                mManagers = managers;
                mCursor   = cursor;

                CreateLayer();

                CreateVisualRepresentation();

                // Create the text after the Layer
                CreateGuideText();

                RulerSide = Wireframe.RulerSide.Top;
            }
            catch (Exception e)
            {
                throw e;
            }
        }
 public PositionControl()
 {
     InitializeComponent();
     //
     if (!DesignerProperties.GetIsInDesignMode(this))
     {
         map.Visibility = Visibility.Collapsed;
         //
         gridBase.Children.Add(dx = new GraphicsDeviceControl());
         dx.SetValue(Grid.RowProperty, 1);
         dx.SetValue(Grid.ColumnProperty, 1);
         dx.LoadContent     += dx_LoadContent;
         dx.RenderXna       += dx_RenderXna;
         dx.WindowCreated   += dx_WindowCreated;
         dx.HwndLButtonDown += dx_HwndLButtonDown;
         dx.HwndLButtonUp   += dx_HwndLButtonUp;
         dx.HwndRButtonDown += dx_HwndRButtonDown;
         dx.HwndRButtonUp   += dx_HwndRButtonUp;
         dx.HwndMouseMove   += dx_HwndMouseMove;
         dx.Visibility       = Visibility.Collapsed;
         //
         region_x = 12;
         region_y = 12;
         //
         try {
             Engine.init();
             GeoBlockSelector.init();
         }
         catch (Exception error) {
             Console.WriteLine("Failed to initialize GeoEngine! " + error.Message);
         }
         //
         try { scene = new TestScene(); }
         catch (Exception error) {
             Console.WriteLine("Failed to initialize Scene! " + error.Message);
         }
     }
 }
Esempio n. 13
0
        public HwndHostInputMapper(GraphicsDeviceControl hwndHost)
        {
            _uiElement   = hwndHost;
            _pressedKeys = new List <Key>();

            _uiElement.KeyDown += HandleKeyDown;
            _uiElement.KeyUp   += HandleKeyUp;

            _hwndHost = hwndHost;

            _hwndHost.HwndMouseMove    += HandleMouseEvent;
            _hwndHost.HwndMouseWheel   += HandleMouseEvent;
            _hwndHost.HwndLButtonDown  += HandleMouseEvent;
            _hwndHost.HwndLButtonUp    += HandleMouseEvent;
            _hwndHost.HwndRButtonDown  += HandleMouseEvent;
            _hwndHost.HwndRButtonUp    += HandleMouseEvent;
            _hwndHost.HwndMButtonDown  += HandleMouseEvent;
            _hwndHost.HwndMButtonUp    += HandleMouseEvent;
            _hwndHost.HwndX1ButtonDown += HandleMouseEvent;
            _hwndHost.HwndX1ButtonUp   += HandleMouseEvent;
            _hwndHost.HwndX2ButtonDown += HandleMouseEvent;
            _hwndHost.HwndX2ButtonUp   += HandleMouseEvent;
        }
        public void EndDraw(GraphicsDeviceControl control)
        {
            if (control.IsDesignMode)
            {
                return;
            }

            if (_chain == null)
            {
                throw new InvalidOperationException("A swap chain is not created for this backend.");
            }

            if (_presentationParameters == null)
            {
                throw new InvalidOperationException("The drawing process is not started. You should call PrepareDraw() and BeginDraw() first.");
            }

            try {
                _chain.PresentInterval = _presentationParameters.PresentationInterval;
                _chain.Present();
            } catch (Exception ex) {
                Debug.Print(ex.ToString());
            }
        }
Esempio n. 15
0
 protected AssetHandler(ContentManager contentManager, GraphicsDeviceControl graphicsDeviceControl)
 {
     ContentManager        = contentManager;
     GraphicsDeviceControl = graphicsDeviceControl;
 }
Esempio n. 16
0
        public CameraController(RenderingLibrary.Camera camera, SystemManagers managers, Cursor cursor, Keyboard keyboard, GraphicsDeviceControl control, Ruler topRuler, Ruler leftRuler)
        {
            this.TopRuler  = topRuler;
            this.LeftRuler = leftRuler;
            Cursor         = cursor;
            Camera         = camera;
            Managers       = managers;

            cameraPanningLogic = new CameraPanningLogic(control, managers, cursor, keyboard);
        }
Esempio n. 17
0
 public ModelHandler(ContentManager contentManager, GraphicsDeviceControl graphicsDeviceControl)
     : base(contentManager, graphicsDeviceControl)
 {
     _modelRenderer = new ModelRenderer(graphicsDeviceControl);
 }
Esempio n. 18
0
 public TextureHandler(ContentManager contentManager, GraphicsDeviceControl graphicsDeviceControl)
     : base(contentManager, graphicsDeviceControl)
 {
     _textureRenderer = new TextureRenderer(graphicsDeviceControl, graphicsDeviceControl.GraphicsDevice);
 }