Example #1
0
 /// <summary>
 /// do all of your rendering here.static This is a base implementation. Any special rendering should override
 /// this method.
 /// </summary>
 /// <param name="batcher">Batcher.</param>
 public virtual void Render(Batcher batcher)
 {
     GraphicsDeviceExt.SetRenderTarget(Core.GraphicsDevice, null);
     batcher.Begin(BlendState.Opaque, Core.DefaultSamplerState, DepthStencilState.None, null);
     batcher.Draw(PreviousSceneRender, System.Numerics.Vector2.Zero, Color.White);
     batcher.End();
 }
Example #2
0
 public override void Render(Batcher batcher)
 {
     GraphicsDeviceExt.SetRenderTarget(Core.GraphicsDevice, null);
     batcher.Begin(BlendState.NonPremultiplied, Core.DefaultSamplerState, DepthStencilState.None, null);
     batcher.Draw(PreviousSceneRender, Vector2.Zero, _color);
     batcher.End();
 }
Example #3
0
        public override void Render(Batcher batcher)
        {
            Core.GraphicsDevice.SetRenderTarget(null);

            // if we are scaling out we dont need to render the previous scene anymore since we want the new scene to be visible
            if (!_isNewSceneLoaded)
            {
                batcher.Begin(BlendState.Opaque, Core.DefaultSamplerState, DepthStencilState.None, null);
                batcher.Draw(PreviousSceneRender, Vector2.Zero, Color.White);
                batcher.End();
            }

            batcher.Begin(_blendState, Core.DefaultSamplerState, DepthStencilState.None, null);
            batcher.Draw(_maskRenderTarget, Vector2.Zero, Color.White);
            batcher.End();
        }
Example #4
0
 public override void Render(Batcher batcher)
 {
     Core.GraphicsDevice.SetRenderTarget(null);
     batcher.Begin(BlendState.NonPremultiplied, Core.DefaultSamplerState, DepthStencilState.None, null);
     batcher.Draw(PreviousSceneRender, _destinationRect, Color.White);
     batcher.End();
 }
Example #5
0
 public override void PreRender(Batcher batcher)
 {
     Core.GraphicsDevice.SetRenderTarget(_maskRenderTarget);
     batcher.Begin(BlendState.AlphaBlend, Core.DefaultSamplerState, DepthStencilState.None, null);
     batcher.Draw(_maskTexture, _maskPosition, null, Color.White, _renderRotation, _maskOrigin,
                  _renderScale, SpriteEffects.None, 0);
     batcher.End();
     Core.GraphicsDevice.SetRenderTarget(null);
 }
Example #6
0
        public override void Render(Batcher batcher)
        {
            Core.GraphicsDevice.SetRenderTarget(null);
            batcher.Begin(BlendState.NonPremultiplied, Core.DefaultSamplerState, DepthStencilState.None, null);

            // we only render the previousSceneRender while fading to _color. It will be null after that.
            if (!_isNewSceneLoaded)
            {
                batcher.Draw(PreviousSceneRender, _destinationRect, Color.White);
            }

            batcher.Draw(_overlayTexture, new Rectangle(0, 0, Screen.Width, Screen.Height), _color);

            batcher.End();
        }
Example #7
0
        /// <summary>
        /// begins an IMGUI window specifying where and how large it should be. If you are not using IMGUI in world space (for example, inside
        /// a Scene with a scaled resolution policy) passing false for useRawMousePosition will use the Input.scaledMousePosition.
        /// </summary>
        /// <param name="x">The x coordinate.</param>
        /// <param name="y">The y coordinate.</param>
        /// <param name="width">Width.</param>
        /// <param name="height">Height.</param>
        /// <param name="useRawMousePosition">If set to <c>true</c> use raw mouse position.</param>
        public static void BeginWindow(float x, float y, float width, float height, bool useRawMousePosition = true)
        {
            _batcher.Begin();

            _batcher.DrawRect(x, y, width, height, WINDOW_COLOR);

            _elementX     = x + ELEMENT_PADDING;
            _lastY        = y;
            _windowWidth  = width;
            _windowHeight = height;
            _elementWidth = _windowWidth - 2f * ELEMENT_PADDING;

            var mousePos = useRawMousePosition ? Input.RawMousePosition : Input.ScaledMousePosition.ToPoint();

            _mouseInWorldCoords = mousePos - new Point(Core.GraphicsDevice.Viewport.X, Core.GraphicsDevice.Viewport.Y);
        }