Exemple #1
0
        public void Draw(Camera camera)
        {
            _particleCamera.Origin               = new System.Numerics.Vector2(camera.Position.X, camera.Position.Y);
            _particleCamera.PixelWidth           = camera.DestinationRectangle.Width;
            _particleCamera.PixelHeight          = camera.DestinationRectangle.Height;
            _particleCamera.HorizontalZoomFactor = camera.DestinationRectangle.Width / camera.OrthogonalWidth;
            _particleCamera.VerticalZoomFactor   = camera.DestinationRectangle.Height / camera.OrthogonalHeight;

            _emitterRenderGroup.Render(_particleCamera, FlatRedBallServices.GraphicsDevice.SamplerStates[0]);
        }
Exemple #2
0
        protected override void Draw(GameTime gameTime)
        {
            var backgroundColorVector = _applicationState.BackgroundColor;
            var backgroundColor       = new Color(backgroundColorVector.X,
                                                  backgroundColorVector.Y,
                                                  backgroundColorVector.Z);

            GraphicsDevice.Clear(backgroundColor);

            _graphicsDeviceManager.GraphicsDevice.SetRenderTarget(_particleRenderArea);
            RenderGrid(backgroundColor);
            RenderReferenceSprite();
            _emitterRenderGroup.Render(_camera, _applicationState.RenderSamplerState ?? SamplerState.PointClamp);
            _graphicsDeviceManager.GraphicsDevice.SetRenderTarget(null);

            var position = new Point();

            if (_applicationState.ActiveEmitter != null)
            {
                position.X = EmitterSettingsController.ActiveEditorWidth;
                position.Y = EmitterSettingsController.WorkbenchHeight - EmitterSettingsController.MenuBarSize;
            }

            _spriteBatch.Begin();
            _spriteBatch.Draw(_particleRenderArea,
                              new Rectangle(position,
                                            new Point(_particleRenderArea.Width, _particleRenderArea.Height)),
                              Color.White);

            _spriteBatch.End();

            GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
            _imGuiManager.RenderElements(gameTime.ElapsedGameTime);

            base.Draw(gameTime);
        }