예제 #1
0
        protected override void DrawElement(ISpritebatch sb)
        {
            if (sb != null)
            {
                if (this.BackgroundImage != null)
                {
                    sb.Draw(this.BackgroundImage, this.Bounds, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, .8f);
                }

                if (this.BackgroundColorTexture != null)
                {
                    sb.Draw(this.BackgroundColorTexture, this.Bounds, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.2f);
                }

                if (this.Border.BorderTexture != null)
                {
                    sb.Draw(this.Border.BorderTexture, this.Border.Bounds, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.25f);
                }

                if (this.TextFont != null)
                {
                    var length = this.TextFont.MeasureString(this.Text);
                    sb.DrawString(this.TextFont, this.Text, this.Bounds.Center.ToVector() - (length / 2f), this.TextColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.3f);
                }
            }
        }
예제 #2
0
 public void Draw(ISpritebatch sb)
 {
     if (sb != null && this.Visibility == Visibility.Visible)
     {
         this.DrawElement(sb);
     }
 }
예제 #3
0
 protected override void DrawElement(ISpritebatch sb)
 {
     if (sb != null)
     {
         sb.DrawString(this.Font, this.Text, new Vector2(this.Bounds.X, this.Bounds.Center.Y - (this.Font.MeasureString(this.Text).Y / 2f)), this.TextColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, .1f);
     }
 }
예제 #4
0
        public override void Draw(ISpritebatch sb)
        {
            if (this.showDebugView)
            {
                this.debugView.RenderDebugData(this.debugViewMatrix, Matrix.Identity);
            }
            else
            {
                this.map.Draw(sb);
            }

            base.Draw(sb);
        }
예제 #5
0
 public void Draw(ISpritebatch sb)
 {
     if (sb != null)
     {
         sb.Draw(
             this.Texture,
             this.Location,
             null,
             Color.White,
             0f,
             this.Location,
             this.Scale,
             SpriteEffects.None,
             this.Depth);
     }
 }
예제 #6
0
 public void Draw(ISpritebatch sb)
 {
     if (sb != null)
     {
         sb.Draw(
             this.Texture,
             this.Location,
             null,
             Color.White,
             0f,
             Vector2.Zero,
             this.Scale,
             SpriteEffects.None,
             this.Depth);
     }
 }
예제 #7
0
        protected override void DrawElement(ISpritebatch sb)
        {
            if (sb != null && this.IsEnabled && this.Visibility == Visibility.Visible)
            {
                sb.Draw(this.BackgroundColorTexture, this.Bounds, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.2f);

                if (this.Font != null)
                {
                    var cropped = this.SubstringToWidth(this.Bounds.Width);
                    sb.DrawString(this.Font, cropped, new Vector2(this.Bounds.X + 2, this.Bounds.Center.Y - (this.TextHeight / 2)), this.TextColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.3f);
                }

                if (this.CanEdit && this.IsActive && this.ShowCursor)
                {
                    sb.Draw(this.CursorTexture, new Vector2(this.Bounds.X + this.WidthToIndex(this.cursorPos) + 2, this.Bounds.Y), null, Color.White, 0f, Vector2.Zero, new Vector2(1f, this.cursorScale), SpriteEffects.None, 0.4f);
                }
            }
        }
예제 #8
0
 public override void Draw(ISpritebatch sb)
 {
     if (sb != null)
     {
         base.Draw(sb);
         sb.Draw(this.menuBack, Vector2.Zero, Color.White);
         sb.DrawString(
                         ContentController.Instance.GetContent<SpriteFont>("MenuFont"),
                         "PAUSED",
                         new Vector2(100, 50),
                         Color.White,
                         0f,
                         Vector2.Zero,
                         5f,
                         SpriteEffects.None,
                         1f);
     }
 }
예제 #9
0
 public override void Draw(ISpritebatch sb)
 {
     if (sb != null)
     {
         base.Draw(sb);
         sb.Draw(this.menuBack, Vector2.Zero, Color.White);
         sb.DrawString(
                         ContentController.Instance.GetContent<SpriteFont>("MenuFont"),
                         "Menu Screen: \n\n Press enter to begin game \n\n Esc to Quit",
                         new Vector2(100, 50),
                         Color.White,
                         0f,
                         Vector2.Zero,
                         1f,
                         SpriteEffects.None,
                         1f);
     }
 }
예제 #10
0
 public void Draw(ISpritebatch sb)
 {
     if (sb != null)
     {
         foreach (var texture in this.textures)
         {
             if (texture.Item1 != null)
             {
                 sb.Draw(
                         texture.Item1,
                         this.MapBodyInfo.Position + texture.Item2,
                         null,
                         Color.White,
                         this.MapBody.Rotation,
                         this.MapBodyInfo.ShapeOffset,
                         1f,
                         SpriteEffects.None,
                         this.fill ? 0.6f : .5f);
             }
         }
     }
 }
예제 #11
0
 public void Draw(ISpritebatch sb)
 {
     if (sb != null)
     {
         foreach (var texture in this.textures)
         {
             if (texture.Item1 != null)
             {
                 sb.Draw(
                     texture.Item1,
                     this.MapBodyInfo.Position + texture.Item2,
                     null,
                     Color.White,
                     this.Body.Rotation,
                     this.MapBodyInfo.ShapeOffset,
                     1f,
                     SpriteEffects.None,
                     this.fill ? 0.6f : .5f);
             }
         }
     }
 }
예제 #12
0
        public virtual void Draw(ISpritebatch sb)
        {
            if (this.IsEnabled)
            {
                if (sb != null && this.VisibleState == Visibility.Visible)
                {
                    foreach (var sprite in this.Sprites.Values)
                    {
                        var effect = SpriteEffects.None;
                        if (sprite.CurrentAnimation.FlipHorizontal)
                        {
                            effect |= SpriteEffects.FlipHorizontally;
                        }

                        if (sprite.CurrentAnimation.FlipVertical)
                        {
                            effect |= SpriteEffects.FlipVertically;
                        }

                        // if the actor does not rotate with the world, keep it upright
                        float drawRotation = this.RotatesWithWorld ? this.Rotation + (-1 * this.Screen.ScreenRotation) : this.Rotation;

                        sb.Draw(
                            sprite.SpriteSheet,
                            this.Position - Vector2.Transform(this.bodyInfo.ShapeOffset, Matrix.CreateRotationZ(drawRotation)) + sprite.Offset,
                            sprite.CurrentSprite,
                            Color.White,
                            drawRotation,
                            Vector2.Zero,
                            1f,
                            effect,
                            sprite.Depth);
                    }
                }
            }
        }
예제 #13
0
파일: Map.cs 프로젝트: 00erik2/Physicist
 public void Draw(ISpritebatch sb)
 {
     this.drawObjects.ForEach(list => list.ForEach(item => item.Draw(sb)));
 }
예제 #14
0
 protected virtual void DrawElement(ISpritebatch sb)
 {
 }
예제 #15
0
        public virtual void Draw(ISpritebatch sb)
        {
            if (this.IsEnabled)
            {
                if (sb != null && this.VisibleState == Visibility.Visible)
                {
                    foreach (var sprite in this.Sprites.Values)
                    {
                        var effect = SpriteEffects.None;
                        if (sprite.CurrentAnimation.FlipHorizontal)
                        {
                            effect |= SpriteEffects.FlipHorizontally;
                        }

                        if (sprite.CurrentAnimation.FlipVertical)
                        {
                            effect |= SpriteEffects.FlipVertically;
                        }

                        sb.Draw(
                            sprite.SpriteSheet,
                            this.Position + sprite.Offset - this.bodyInfo.ShapeOffset,
                            sprite.CurrentSprite,
                            Color.White,
                            this.Rotation,
                            Vector2.Zero,
                            1f,
                            effect,
                            sprite.Depth);
                    }
                }
            }
        }
        public override void Draw(ISpritebatch sb)
        {
            this.map.Draw(sb);

            base.Draw(sb);
        }
예제 #17
0
파일: Actor.cs 프로젝트: 00erik2/Physicist
        public virtual void Draw(ISpritebatch sb)
        {
            if (this.IsEnabled)
            {
                if (sb != null && this.VisibleState == Visibility.Visible)
                {
                    foreach (var sprite in this.Sprites.Values)
                    {
                        var effect = SpriteEffects.None;
                        if (sprite.CurrentAnimation.FlipHorizontal)
                        {
                            effect |= SpriteEffects.FlipHorizontally;
                        }

                        if (sprite.CurrentAnimation.FlipVertical)
                        {
                            effect |= SpriteEffects.FlipVertically;
                        }

                        // if the actor does not rotate with the world, keep it upright
                        float drawRotation = -1 * this.Screen.ScreenRotation;
                        if (this.RotatesWithWorld)
                        {
                            drawRotation = this.Rotation;
                        }

                        sb.Draw(
                            sprite.SpriteSheet,
                            this.Position + sprite.Offset - this.bodyInfo.ShapeOffset,
                            sprite.CurrentSprite,
                            Color.White,
                            drawRotation,
                            Vector2.Zero,
                            1f,
                            effect,
                            sprite.Depth);
                    }
                }
            }
        }
예제 #18
0
 public virtual void Draw(ISpritebatch sb)
 {
 }