예제 #1
0
        internal override void Apply(ShapeBatch shapeBatch, MeshSlice slice, VertigoState state, int effectDataIndex)
        {
            T effectData = default;

            if (effectDataIndex >= 0 && effectDataIndex <= stateBuffer.Count)
            {
                effectData = stateBuffer.Array[effectDataIndex];
            }

            Apply(shapeBatch, state, effectData, slice);
        }
예제 #2
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            // Begin a shape batch
            ShapeBatch.Begin(GraphicsDevice);

            // Draw several example shapes
            DrawExampleShapes(gameTime);

            // End the shape batch
            ShapeBatch.End();

            base.Draw(gameTime);
        }
예제 #3
0
        /// <summary>
        /// Draws several example shapes to showcase ShapeBatch capabilities
        /// </summary>
        /// <param name="gt">Game time information</param>
        public void DrawExampleShapes(GameTime gt)
        {
            // Sample values for "animation"
            float rotation = (float)gt.TotalGameTime.TotalSeconds;
            float sinWave  = MathF.Sin(rotation) + 2.0f;

            // Lines
            ShapeBatch.Line(new Vector2(50, 50), new Vector2(150, 70), Color.White);
            ShapeBatch.Line(new Vector2(50, 150), new Vector2(150, 220), 8.0f, Color.Pink, Color.Purple);
            ShapeBatch.Line(new Vector2(100, 250), 75.0f, rotation, Color.DarkKhaki);
            ShapeBatch.Line(new Vector2(100, 350), 75.0f, rotation + MathF.PI / 2.0f, 10.0f, Color.MediumPurple);

            // Boxes
            ShapeBatch.Box(200, 50, 50, 50, Color.IndianRed, Color.IndianRed, Color.BlueViolet, Color.BlueViolet);
            ShapeBatch.Box(new Rectangle(220, 150, 50, 60), Color.PapayaWhip);

            // Outline boxes
            ShapeBatch.BoxOutline(200, 250, 50, 50, Color.Gainsboro);
            ShapeBatch.BoxOutline(new Rectangle(220, 350, 75, 60), Color.LawnGreen, Color.DarkGreen, Color.MediumSeaGreen, Color.DarkGreen);

            // Circles
            ShapeBatch.Circle(new Vector2(350, 75), sinWave * 20.0f, Color.Black, Color.Aquamarine);
            ShapeBatch.Circle(new Vector2(350, 225), sinWave * 10.0f + 20.0f, 8, Color.AliceBlue);
            ShapeBatch.Circle(new Vector2(350, 375), sinWave * 5.0f + 20.0f, 5, -rotation, Color.LightGoldenrodYellow);

            // Outline circles
            ShapeBatch.CircleOutline(new Vector2(425, 125), 25.0f, Color.Aquamarine);
            ShapeBatch.CircleOutline(new Vector2(425, 275), 30.0f, 8, Color.AliceBlue);
            ShapeBatch.CircleOutline(new Vector2(425, 425), 35.0f, 5, rotation, Color.LightGoldenrodYellow);

            // Triangles
            ShapeBatch.Triangle(new Vector2(550, 75), 100, Color.Orange, Color.OrangeRed, Color.Yellow);
            ShapeBatch.Triangle(new Vector2(550, 250), 75, rotation, Color.Red, Color.ForestGreen, Color.Blue);
            ShapeBatch.Triangle(new Vector2(550, 475), new Vector2(475, 420), new Vector2(675, 350), Color.CornflowerBlue, Color.DarkBlue, Color.LightBlue);

            // Outline triangles
            ShapeBatch.TriangleOutline(new Vector2(650, 150), 60, Color.Orange);
            ShapeBatch.TriangleOutline(new Vector2(650, 275), 60, rotation / -2.0f, Color.Red, Color.ForestGreen, Color.Blue);
            ShapeBatch.TriangleOutline(new Vector2(650, 450), new Vector2(550, 360), new Vector2(750, 400), Color.CornflowerBlue);
        }
예제 #4
0
 public bool CanRunWithKeywords(List <string> keywords, ShapeBatch batch, in ShadowData data)
예제 #5
0
 protected virtual void Apply(ShapeBatch batch, in VertigoState state, in T data, in MeshSlice meshSlice)