Beispiel #1
0
        private void DrawTextures()
        {
            var grass = SpriteLoader.Instance.AddSprite("content/title_grass");

            Menu.PreDraw(this);

            SetRenderTarget(GrassNoise);
            GraphicsDevice.Clear(Color.Black);

            var proj = Matrix.CreateOrthographicOffCenter(0, GrassNoise.Width, GrassNoise.Height, 0, 0, -1);

            PushSpriteBatch(samplerState: SamplerState.PointWrap, blendState: NonPremultiplied, shader: Shader, projection: proj, shaderSetup: (transform, projection) =>
            {
                SetupColorMatrix(ColorMatrix.Identity, transform, projection);
            });

            for (int x = 0; x < GrassWidth; x++)
            {
                for (int y = 0; y < GrassHeight; y++)
                {
                    DrawSprite(grass, Noise.GetValue(x, y), new Vector2(x, y) * 16, SpriteEffects.None, 0);
                }
            }

            PopSpriteBatch();

            SetRenderTarget(GrassMap);
            GraphicsDevice.Clear(Color.Black);

            PushSpriteBatch(samplerState: SamplerState.PointWrap, blendState: NonPremultiplied, transform: Matrix.Identity, projection: Projection, shader: Shader, shaderSetup: (transform, projection) =>
            {
                SetupColorMatrix(ColorMatrix.Identity, Matrix.Identity, Projection);
            });
            var shadow      = SpriteLoader.Instance.AddSprite("content/title_morpho_shadow");
            var shadowSword = SpriteLoader.Instance.AddSprite("content/title_morpho_shadow_sword");

            shadowSword.ShouldLoad = true;
            PushSpriteBatch(shader: Shader, shaderSetup: (transform, projection) =>
            {
                SetupUVScroll(GroundOffset * -1 / new Vector2(GrassNoise.Width, GrassNoise.Height), transform, projection);
            });
            SpriteBatch.Draw(GrassNoise, Viewport.Bounds, Viewport.Bounds, Color.White);
            PopSpriteBatch();
            if (TitleSM.CurrentState >= TitleState.TextSlash)
            {
                DrawSpriteExt(shadowSword, Frame / 10, MorphoPosition - shadowSword.Middle, shadowSword.Middle, Util.VectorToAngle(MorphoFacing) + MathHelper.Pi, new Vector2(0.5f), SpriteEffects.None, new Color(255, 255, 255, 64), 0);
            }
            else
            {
                DrawSpriteExt(shadow, Frame / 10, MorphoPosition - shadow.Middle, shadow.Middle, Util.VectorToAngle(MorphoFacing) + MathHelper.Pi, new Vector2(0.5f), SpriteEffects.None, new Color(255, 255, 255, 64), 0);
            }
            foreach (var particle in GroundParticles)
            {
                particle.Draw(this);
            }

            PopSpriteBatch();
        }
Beispiel #2
0
 private void DrawTextures()
 {
     Menu.PreDraw(this);
 }