Beispiel #1
0
        /// <summary>
        /// Draws every visualizable element.
        /// </summary>
        public void Draw(ExtendedSpriteBatch spriteBatch, AutomaticTurnGame game) {
            float interpolate = 1.0f;
            if (Interpolate) {
                interpolate = game.InterpolationPercentage;
            }

            foreach (IVisualizable visualizable in _visualizable) {
                visualizable.Draw(spriteBatch, interpolate);
            }
        }
        public override void Draw(ExtendedSpriteBatch spriteBatch, float percentage) {
            Bound prev = _entity.Previous<PositionData>().Position;
            Bound curr = _entity.Current<PositionData>().Position;

            // some magic constants that center the rendering in the window; the sample doesn't
            // bother to properly setup a coordinate system
            Real scale = 25;
            Real zoffset = 250;
            Real xoffset = 350;

            int x = (Interpolate(prev.X, curr.X, percentage) * scale + xoffset).AsInt;
            int z = (Interpolate(-prev.Z, -curr.Z, percentage) * scale + zoffset).AsInt;
            int radius = (Interpolate(prev.Radius, curr.Radius, percentage) * scale).AsInt;

            Rectangle rectangle = new Rectangle(x - radius, z - radius, 2 * radius, 2 * radius);
            spriteBatch.DrawRectangle(rectangle, Color.BlanchedAlmond);
        }
Beispiel #3
0
        public override void Draw(ExtendedSpriteBatch spriteBatch, float percentage)
        {
            Bound prev = _entity.Previous <PositionData>().Position;
            Bound curr = _entity.Current <PositionData>().Position;

            // some magic constants that center the rendering in the window; the sample doesn't
            // bother to properly setup a coordinate system
            Real scale   = 25;
            Real zoffset = 250;
            Real xoffset = 350;

            int x      = (Interpolate(prev.X, curr.X, percentage) * scale + xoffset).AsInt;
            int z      = (Interpolate(-prev.Z, -curr.Z, percentage) * scale + zoffset).AsInt;
            int radius = (Interpolate(prev.Radius, curr.Radius, percentage) * scale).AsInt;

            Rectangle rectangle = new Rectangle(x - radius, z - radius, 2 * radius, 2 * radius);

            spriteBatch.DrawRectangle(rectangle, Color.BlanchedAlmond);
        }
Beispiel #4
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     _spriteBatch = new ExtendedSpriteBatch(GraphicsDevice);
 }
Beispiel #5
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load all of your content.
 /// </summary>
 protected override void LoadContent() {
     _spriteBatch = new ExtendedSpriteBatch(GraphicsDevice);
 }
 /// <summary>
 /// Called when the renderer should draw itself.
 /// </summary>
 public abstract void Draw(ExtendedSpriteBatch spriteBatch, float percentage);
 public void Draw(ExtendedSpriteBatch spriteBatch) {
     Visualizer.Instance.Draw(spriteBatch, _turnGame);
 }