Ejemplo n.º 1
0
 public RenderAction(DxRender.DxDeviceContext devices,
                     DxRender.IDxRenderer render,
                     States states,
                     IOnTickActionContext context)
     : this(devices, render, states)
 {
 }
Ejemplo n.º 2
0
 public CaptureAction(DxRender.DxDeviceContext devices,
                      DxRender.IDxRenderer render,
                      States states,
                      CaptureSettings settings)
     : this(devices, render, states, new Context(devices, settings))
 {
 }
Ejemplo n.º 3
0
        public RenderAction(DxRender.DxDeviceContext devices,
                            DxRender.IDxRenderer render,
                            States states)
        {
            _devices = devices;
            _render  = render;
            _states  = states;

            _stAspect      = new DxRender.DefaultStyleAspect();
            _rtAspect      = new DxRender.ScreenRenderTargetAspect(_devices);
            _renderContext = new Mitosis.DxRender.DxRenderContext(_stAspect, _rtAspect);
        }
Ejemplo n.º 4
0
        private void SafeRelease()
        {
            if (_srlAction != null)
            {
                _srlAction.Dispose();
            }
            _srlAction = null;
            if (_gepAction != null)
            {
                _gepAction.Dispose();
            }
            _gepAction = null;
            if (_rAction != null)
            {
                _rAction.Dispose();
            }
            _rAction = null;
            if (_cAction != null)
            {
                _cAction.Dispose();
            }
            _cAction = null;
            if (_sAction != null)
            {
                _sAction.Dispose();
            }
            _sAction = null;
            if (_spfAction != null)
            {
                _spfAction.Dispose();
            }
            _spfAction = null;

            if (_render != null)
            {
                _render.Dispose();
            }
            _render = null;
            if (_devices != null)
            {
                _devices.Dispose();
            }
            _devices = null;
        }
Ejemplo n.º 5
0
        public MainFormContext(Form owner,
                               Control renderArea,
                               TrackBar trackBar,
                               Label timeLabel,
                               Button startStopButton,
                               NumericUpDown speedBox,
                               Button screenshotButton,
                               Button videoCaptureButton,
                               Button showPropsButton)
        {
            _shouldRecreate = false;
            _recreateSavers = false;

            _owner      = owner;
            _renderArea = renderArea;

            _devices = new DxRender.DxDeviceContext(_owner.Handle, _renderArea, false);
            _render  = new DxRender.GeometricDxRenderer(_devices);
            _states  = new States();

            _srlAction = new SimResultsLoadingAction(_states);
            _gepAction = new GuiEventProcessingAction(_devices,
                                                      _states,
                                                      _owner,
                                                      _renderArea,
                                                      trackBar,
                                                      timeLabel,
                                                      startStopButton,
                                                      speedBox,
                                                      screenshotButton,
                                                      videoCaptureButton);
            _rAction   = new RenderAction(_devices, _render, _states);
            _cAction   = new CaptureAction(_devices, _render, _states, SettingsManager.GetRef().CaptureSettings);
            _sAction   = new SelectAction(_devices, _render, _states);
            _spfAction = new SelectionPopupFormAction(_states, _owner, showPropsButton);

            if (!_states.IsInitialized)
            {
                throw new ApplicationException("Internal error - failed to register all state providers");
            }
        }
Ejemplo n.º 6
0
        public SelectAction(DxRender.DxDeviceContext devices,
                            DxRender.IDxRenderer render,
                            States states,
                            IOnTickActionContext context)
        {
            _context = context as Context;

            _devices = devices;
            _render  = render;
            _states  = states;

            _rtAspect
                      = new Mitosis.DxRender.TextureRenderTargetAspect(_devices, _devices.FrameWidth, _devices.FrameHeight);
            _stAspect = new Mitosis.DxRender.ObjectSelectingStyleAspect();

            _renderContext = new Mitosis.DxRender.DxRenderContext(_stAspect, _rtAspect);

            foreach (var stateProvider in _context.StateProviders)
            {
                _states.RegisterStateProvider(stateProvider);
            }
        }
Ejemplo n.º 7
0
        private void SafeRecreate()
        {
            IOnTickActionContext srlActionContext = _srlAction.DisposeAndExportContext();
            IOnTickActionContext gepActionContext = _gepAction.DisposeAndExportContext();
            IOnTickActionContext rActionContext   = _rAction.DisposeAndExportContext();
            IOnTickActionContext cActionContext   = _cAction.DisposeAndExportContext();
            IOnTickActionContext sActionContext   = _sAction.DisposeAndExportContext();
            IOnTickActionContext spfActionContext = _spfAction.DisposeAndExportContext();

            _states.RemoveStateProviders();

            _render.Dispose();
            _devices.Dispose();

            _devices = new Mitosis.DxRender.DxDeviceContext(_owner.Handle, _renderArea, false);
            _render  = new DxRender.GeometricDxRenderer(_devices);

            _srlAction = new SimResultsLoadingAction(_states, srlActionContext);
            _gepAction = new GuiEventProcessingAction(_devices, _states, gepActionContext);
            _rAction   = new RenderAction(_devices, _render, _states, rActionContext);
            if (_recreateSavers)
            {
                cActionContext.Dispose();
                _cAction = new CaptureAction(_devices, _render, _states, SettingsManager.GetRef().CaptureSettings);
            }
            else
            {
                _cAction = new CaptureAction(_devices, _render, _states, cActionContext);
            }

            _sAction   = new SelectAction(_devices, _render, _states, sActionContext);
            _spfAction = new SelectionPopupFormAction(_states, spfActionContext);

            if (!_states.IsInitialized)
            {
                throw new ApplicationException("Internal error - failed to register all state providers");
            }
        }
Ejemplo n.º 8
0
        public CaptureAction(DxRender.DxDeviceContext devices,
                             DxRender.IDxRenderer render,
                             States states,
                             IOnTickActionContext context)
        {
            _states  = states;
            _devices = devices;
            _render  = render;

            _context = context as Context;

            _imageRttAspect
                = new DxRender.TextureRenderTargetAspect(devices, _context.ImageWidth, _context.ImageHeight);
            _imageRenderContext = new Mitosis.DxRender.DxRenderContext(new DxRender.DefaultStyleAspect(), _imageRttAspect);

            _videoRttAspect
                = new Mitosis.DxRender.TextureRenderTargetAspect(devices, _context.VideoWidth, _context.VideoHeight);
            _videoRenderContext = new Mitosis.DxRender.DxRenderContext(new DxRender.DefaultStyleAspect(), _videoRttAspect);

            foreach (IStateProvider stateProvider in _context.StateProviders)
            {
                _states.RegisterStateProvider(stateProvider);
            }
        }
Ejemplo n.º 9
0
 public SelectAction(DxRender.DxDeviceContext devices,
                     DxRender.IDxRenderer render,
                     States states)
     : this(devices, render, states, new Context())
 { /*nothing*/
 }