Наследование: GraphicsResource
 public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     if (sprite != null && visible)
     {
         spriteBatch.Draw(sprite, position, null, Color.White, 0, Vector2.Zero, new Vector2(1, spriteScale), SpriteEffects.None, 0);
     }
 }
        public void DrawFlagScore(SpriteBatch spriteBatch, GameTime gameTime, float stoppingHeight)
        {
            scoreOrigin = ScoreFont.MeasureString(scoreText) / GameValues.ScoreSpriteScoreOriginOffset;

            spriteBatch.DrawString(ScoreFont, scoreText, new Vector2(Position.X, Position.Y - GameValues.ScoreSpriteDrawFlagScoreYOffset), Color.White, 0, scoreOrigin, 0.4f, SpriteEffects.None, 0f);

            if (Position.Y > stoppingHeight)
            {
                Position = new Vector2(Position.X, Position.Y - GameValues.ScoreSpriteDrawFlagScoreDropOffet);
            }
            else if (Position.Y <= stoppingHeight)
            {
                //Position.Y = stoppingHeight;
                Position = new Vector2(Position.X, stoppingHeight);
                if (scoreBuffer <= 0)
                {
                    scoreBuffer = GameValues.ScoreSpriteScoreBuffer;
                    ScoringOn = !ScoringOn;
                }
                else
                {
                    scoreBuffer--;
                }
            }
        }
Пример #3
1
        public Human(Game game, SpriteBatch screenSpriteBatch,
            PlayerSide playerSide)
            : base(game, screenSpriteBatch)
        {
            string idleTextureName = "";
            this.playerSide = playerSide;

            if (playerSide == PlayerSide.Left)
            {
                catapultPosition = new Vector2(140, 332);
                idleTextureName = "Textures/Catapults/Blue/blueIdle/blueIdle";
            }
            else
            {
                catapultPosition = new Vector2(600, 332);
                spriteEffect = SpriteEffects.FlipHorizontally;
                idleTextureName = "Textures/Catapults/Red/redIdle/redIdle";
            }

            Catapult = new Catapult(game, screenSpriteBatch,
                                    idleTextureName, catapultPosition,
                                    spriteEffect,
                                    playerSide == PlayerSide.Left
                                        ? false : true, true);
        }
Пример #4
1
 public void AllDraw(SpriteBatch spriteBatch)
 {
     for (int i = 0; i < Backgrounds.Count; i++)
     {
         Backgrounds[i].Draw(spriteBatch);
     }
 }
Пример #5
1
 public C_Maps()
 {
     //init stuff here
     m_mousePosition = Vector2.Zero;
     m_font1 = null;
     m_spriteBatch = null;
 }
Пример #6
1
 public RenderingExplosion(ContentManager Content)
     : base(Content)
 {
     spriteBatch = Content.ServiceProvider.GetService(typeof(SpriteBatch)) as SpriteBatch;
     explosionTexture = Content.Load<Texture2D>("TroopTexture/explosion");
     stateGame = Content.ServiceProvider.GetService(typeof(StateGame)) as StateGame;
 }
Пример #7
1
 public void Draw(SpriteBatch spriteBatch)
 {
     foreach (Item item in itemList)
     {
         item.Draw(spriteBatch);
     }
 }
Пример #8
1
 public void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
     dungeonMap.Draw(spriteBatch);
     player.MapDraw(spriteBatch);
     spriteBatch.End();
 }
Пример #9
1
 public void debugDraw(SpriteBatch spritebatch, Texture2D texture)
 {
     foreach (Node nod in nodes){
         Vector2 adjustedPos = new Vector2(nod.Position.X - texture.Width/2, nod.Position.Y - texture.Height/2);
         spritebatch.Draw (texture, adjustedPos, Color.White);
     }
 }
Пример #10
1
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);

            foreach (Bullet bullet in bulletList)
                bullet.Draw(spriteBatch);
        }
 public void Draw(SpriteBatch spriteBatch)
 {
     foreach (Creep c in creepWave)
     {
         c.Draw(spriteBatch);
     }
 }
 public override void Draw(SpriteBatch spriteBatch)
 {
     base.Draw(spriteBatch);
     Site.Draw(spriteBatch);
     if (MyProjectile != null && MyProjectile.ProjectileState != Projectile.PROJECTILE_STATE.STILL)
             MyProjectile.Draw(spriteBatch);
 }
Пример #13
1
 public override void Draw(SpriteBatch sprite)
 {
     if (Config.statusGry != GameState.menu)
     {
         while (pozycja.X < Config.rozmiarPlanszy.X)
         {
             pozycja.Y = 0;
             if (Camera.CzyWWidoku(this))
                 Rysuj(sprite, teksturaPodstawowa, Camera.PozycjaWgKamery(pozycja), wielkoscObiektu);
             pozycja.Y = Config.rozmiarPlanszy.Y;
             if (Camera.CzyWWidoku(this))
                 Rysuj(sprite, teksturaPodstawowa, Camera.PozycjaWgKamery(pozycja), wielkoscObiektu);
             pozycja.X += teksturaPodstawowa.Width + 20;
         }
         pozycja = new Vector2(0, 0);
         while (pozycja.Y < Config.rozmiarPlanszy.Y)
         {
             pozycja.X = 0;
             if (Camera.CzyWWidoku(this))
                 Rysuj(sprite, teksturaPodstawowa, Camera.PozycjaWgKamery(pozycja), wielkoscObiektu);
             pozycja.X = Config.rozmiarPlanszy.X;
             if (Camera.CzyWWidoku(this))
                 Rysuj(sprite, teksturaPodstawowa, Camera.PozycjaWgKamery(pozycja), wielkoscObiektu);
             pozycja.Y += teksturaPodstawowa.Height + 20;
         }
         pozycja = new Vector2(0, 0);
     }
 }
Пример #14
1
 public void Draw(SpriteBatch spriteBatch)
 {
     if (this.tupianwenzi.IsShowing)
     {
         this.tupianwenzi.Draw(spriteBatch);
     }
 }
Пример #15
1
        public override void DrawObjects(GraphicsDevice graphicDevice, SpriteBatch spriteBatch, ContentManager content)
        {
            graphicDevice.Clear(Color.CornflowerBlue);
            SpriteFont newFont = content.Load<SpriteFont>(@"Fonts/Text");

            spriteBatch.Begin();

            this.controlScreenBackgroundPosition = new Vector2(0, 0);
            spriteBatch.Draw(this.controlScreenBackgroundTexture, this.controlScreenBackgroundPosition, Color.White);

            if (this.controlScreenItems.Count < 1)
            {
                // Back planket and text;
                this.buttonPosition = new Vector2(840, 660);
                this.controlScreenItems.Add(new MenuItems(this.button, this.buttonPosition, "Back", newFont, false));
            }

            this.controlScreenItems[this.selectedEntry].Selected = true;
            foreach (var item in this.controlScreenItems)
            {
                item.DrawMenuItems(spriteBatch, new Color(248, 218, 127));
            }

            this.DrawCursor(spriteBatch);
            spriteBatch.End();
        }
Пример #16
1
        public void Render(SpriteBatch spriteBatch)
        {
            SmoothScroll();

            int xLoop = (int)(drawArea.Width / tileSize.X);
            if (xLoop >= tiles.Length) xLoop = tiles.Length;

            for (int x = 0; x < xLoop; x++)
            {
                int yLoop = (int)(drawArea.Height / tileSize.Y);
                if (yLoop >= tiles[x].Length) yLoop = tiles[x].Length;

                for (int y = 0; y < yLoop; y++)
                {
                    float xpos = ((x * tileSize.X) + drawOffset.X) + drawArea.X;
                    float ypos = ((y * tileSize.Y) + drawOffset.Y) + drawArea.Y;

                    if (tileOffset.X < 0) tileOffset.X = 0;
                    if (tileOffset.Y < 0) tileOffset.Y = 0;
                    if ((tileOffset.Y + y) >= tiles[x].Length) tileOffset.Y = MaxOffset('Y', x);
                    if ((tileOffset.X + x) >= tiles.Length) tileOffset.X = MaxOffset('X', 0);

                    tiles[x + tileOffset.X][y + tileOffset.Y].Prepare(new Vector2(xpos, ypos), false);
                    tiles[x + tileOffset.X][y + tileOffset.Y].Render(spriteBatch);
                }
            }
        }
Пример #17
1
 public virtual void draw(TileDrawInfo drawInfo, SpriteBatch spriteBatch)
 {
     switch (drawInfo.tilePart)
     {
         case TilePart.STRUCTURE:
             foreach (Drawable structure in structures)
             {
                 adjustedDepthDraw(structure, drawInfo, spriteBatch);
             }
             break;
         case TilePart.SURFACE:
             if (surface == null)
             {
                 break;
             }
             adjustedDepthDraw(surface, drawInfo, spriteBatch);
             break;
         case TilePart.LEFTFACE:
             if (leftFace == null)
             {
                 break;
             }
             adjustedDepthDraw(leftFace, drawInfo, spriteBatch);
             break;
         case TilePart.RIGHTFACE:
             if (rightFace == null)
             {
                 break;
             }
             adjustedDepthDraw(rightFace, drawInfo, spriteBatch);
             break;
     }
 }
Пример #18
1
 public static void RenderPolygone(SpriteBatch spriteBatch, Texture2D texture, Polygon polygon, int lineThickness, Color color)
 {
     for (int i = 0; i < polygon.Points.Count; ++i)
     {
         RenderLine(spriteBatch, texture, polygon.Points[i], polygon.Edges[i], 1, lineThickness, color);
     }
 }
Пример #19
1
 public void draw(SpriteBatch spriteBatch)
 {
     foreach (Laser baseProjectile in m_LaserArray)
     {
         baseProjectile.draw(spriteBatch);
     }
 }
Пример #20
1
        public virtual void Draw(SpriteBatch spriteBatch)
        {
            float left = Position.X + (EdgeTexture.Height / 2.0f);
            float top = Position.Y + (EdgeTexture.Height / 2.0f);
            float right = left + Dimensions.X - EdgeTexture.Height;
            float bottom = top + Dimensions.Y - EdgeTexture.Height;

            RenderTools.Line(spriteBatch, EdgeTexture, new Vector2(left, top), new Vector2(right, top), 1.0f, EdgeTint, RenderDepth);
            RenderTools.Line(spriteBatch, EdgeTexture, new Vector2(left, top), new Vector2(left, bottom), 1.0f, EdgeTint, RenderDepth);
            RenderTools.Line(spriteBatch, EdgeTexture, new Vector2(left, bottom), new Vector2(right, bottom), 1.0f, EdgeTint, RenderDepth);
            RenderTools.Line(spriteBatch, EdgeTexture, new Vector2(right, top), new Vector2(right, bottom), 1.0f, EdgeTint, RenderDepth);

            if (CornerTexture != null)
            {
                spriteBatch.Draw(CornerTexture, new Vector2(left, top), null, EdgeTint, 0.0f, new Vector2(CornerTexture.Width, CornerTexture.Height) / 2.0f, 1.0f, SpriteEffects.None, RenderDepth - 0.005f);
                spriteBatch.Draw(CornerTexture, new Vector2(right, top), null, EdgeTint, MathHelper.PiOver2, new Vector2(CornerTexture.Width, CornerTexture.Height) / 2.0f, 1.0f, SpriteEffects.None, RenderDepth - 0.005f);
                spriteBatch.Draw(CornerTexture, new Vector2(right, bottom), null, EdgeTint, MathHelper.Pi, new Vector2(CornerTexture.Width, CornerTexture.Height) / 2.0f, 1.0f, SpriteEffects.None, RenderDepth - 0.005f);
                spriteBatch.Draw(CornerTexture, new Vector2(left, bottom), null, EdgeTint, MathHelper.Pi * 1.5f, new Vector2(CornerTexture.Width, CornerTexture.Height) / 2.0f, 1.0f, SpriteEffects.None, RenderDepth - 0.005f);
            }

            if (BackgroundTexture != null)
            {
                Rectangle area = new Rectangle((int)left, (int)top, (int)(right - left),(int)(bottom - top));
                spriteBatch.Draw(BackgroundTexture, area, null, BackgroundTint, 0.0f, Vector2.Zero, SpriteEffects.None, RenderDepth + 0.005f);
            }
        }
Пример #21
1
 public void Draw(SpriteBatch spriteBatch)
 {
     if (active)
         {
             pickupAnimation.Draw(spriteBatch);
         }
 }
Пример #22
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            float width       = texture.getTexture().Width *getTransformedScale();
            float lengthDrawn = 0;

            position    = character.position + start;
            origin      = new Vector2(0, texture.getTexture().Height / 2f);
            dualScale.Y = 1f - 2f * Math.Abs(time / speed - .5f);
            Console.WriteLine("Time: " + time + " Speed: " + speed + " Scale: " + dualScale.Y);
            alpha = dualScale.Y;

            if (direction.Y != 0)
            {
                rotation = MathHelper.ToRadians(90);
            }

            while (lengthDrawn < distance)
            {
                width = texture.getTexture().Width *getTransformedScale();
                if (direction == new Vector2(1, 0) || direction == new Vector2(0, 1))
                {
                    base.Draw(spriteBatch);
                }
                lengthDrawn += width;
                position    += width * direction;
                if (direction == new Vector2(-1, 0) || direction == new Vector2(0, -1))
                {
                    base.Draw(spriteBatch);
                }
            }

            position = character.position + start + distance / 2f * direction;
        }
Пример #23
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color lightColor)
        {
            if (projectile.velocity == Vector2.Zero)
            {
                return(false);
            }

            Texture2D tex2   = Main.projectileTexture[projectile.type];
            float     num210 = projectile.localAI[1];

            Microsoft.Xna.Framework.Color c_ = new Microsoft.Xna.Framework.Color(255, 255, 255, 127);
            Vector2 value20 = projectile.Center.Floor();

            num210 -= projectile.scale * 10.5f;
            Vector2 vector41 = new Vector2(projectile.scale);

            DelegateMethods.f_1 = 1f;
            DelegateMethods.c_1 = c_;
            DelegateMethods.i_1 = 54000 - (int)Main.time / 2;
            Utils.DrawLaser(Main.spriteBatch, tex2, value20 - Main.screenPosition, value20 + projectile.velocity * num210 - Main.screenPosition, vector41, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw));
            DelegateMethods.c_1 = new Color(255, 255, 255, 127) * 0.75f * projectile.Opacity;
            Utils.DrawLaser(Main.spriteBatch, tex2, value20 - Main.screenPosition, value20 + projectile.velocity * num210 - Main.screenPosition, vector41 / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw));

            return(false);
        }
Пример #24
0
    public override void Draw(GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
    {
        Color barColor = Color.White;

        if (type == 1)
        {
            barColor = Color.Red;
            this.Sprite.SpriteColor = Color.Red;
        }
        else if (type == 2)
        {
            barColor = Color.Purple;
            this.Sprite.SpriteColor = Color.Purple;
        }
        else if (type == 3)
        {
            barColor = Color.Yellow;
            this.Sprite.SpriteColor = Color.Yellow;
        }
        else if (type == 4)
        {
            barColor = Color.Blue;
            this.Sprite.SpriteColor = Color.Blue;
            car.Position            = new Vector2((float)(this.Position.X + this.sprite.Width * ((double)resource / totalResource)), this.Position.Y);
        }
        base.Draw(gameTime, spriteBatch);
        spriteBatch.Draw(barPart,
                         new Rectangle((int)Position.X,
                                       (int)Position.Y,
                                       (int)(sprite.Width * ((double)resource / totalResource)),
                                       sprite.Height), barColor);
    }
Пример #25
0
 ///
 /// Draws the block to the sprite batch.
 ///
 /// <param name="sb">The sprite batch.</param>
 public virtual void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
 {
     if (!Destroyed)
     {
         sb.Draw(texture, new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height), color);
     }
 }
Пример #26
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            TileSet tileset = gui.Game.CurrentWorld.Level.TileSet;

            sb.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone);

            for (int y = 0; y < tileset.Height - TileMenu_StartY; y++)
            {
                for (int x = 0; x < tileset.Width - TileMenu_StartX; x++)
                {
                    Color c = Color.White;

                    if (new Rectangle(gui.Game.GraphicsDevice.Viewport.Width - 32 * 6 + x * 32, y * 32, 32, 32).Contains((int)gui.InputManager.MousePosition.X, (int)gui.InputManager.MousePosition.Y))
                    {
                        c = Color.Gray;
                    }

                    if (pattern.contains(x + TileMenu_StartX, y + TileMenu_StartY))
                    {
                        c = Color.Red;
                    }

                    sb.Draw(tileset.Texture, new Vector2(gui.Game.GraphicsDevice.Viewport.Width - 32 * 6 + x * 32, y * 32), tileset[x + TileMenu_StartX, y + TileMenu_StartY].Source, c);
                }
            }

            sb.End();
        }
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
        {
            SpriteEffects spriteEffects = 0;
            Color         alpha         = npc.GetAlpha(drawColor);
            Color         color         = Lighting.GetColor((int)(npc.position.X + npc.width * 0.5) / 16, (int)((npc.position.Y + npc.height * 0.5) / 16.0));
            Texture2D     texture2D     = Main.npcTexture[npc.type];
            int           num           = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type];
            int           num2          = num * (int)npc.frameCounter;
            Rectangle     rectangle     = new Rectangle(0, num2, texture2D.Width, num);
            Vector2       vector        = rectangle.Size() / 2f;
            int           num3          = 8;
            int           num4          = 1;
            int           num5          = 1;
            float         num6          = 0f;
            int           num7          = num5;

            while (((num4 > 0 && num7 < num3) || (num4 < 0 && num7 > num3)) && Lighting.NotRetro)
            {
                Color color2 = npc.GetAlpha(color);
                float num8   = (num3 - num7);
                if (num4 < 0)
                {
                    num8 = (num5 - num7);
                }
                color2 *= num8 / (NPCID.Sets.TrailCacheLength[npc.type] * 1.5f);
                Vector2 vector2  = npc.oldPos[num7];
                float   rotation = npc.rotation;
                Main.spriteBatch.Draw(texture2D, vector2 + npc.Size / 2f - Main.screenPosition + new Vector2(0f, npc.gfxOffY), new Rectangle?(rectangle), color2, rotation + npc.rotation * num6 * (num7 - 1) * -spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), vector, npc.scale, spriteEffects, 0f);
                num7 += num4;
            }
            SpriteEffects spriteEffects2 = (npc.direction == -1) ? SpriteEffects.None : SpriteEffects.FlipHorizontally;

            spriteBatch.Draw(texture2D, npc.Center - Main.screenPosition + new Vector2(0f, npc.gfxOffY), new Rectangle?(npc.frame), alpha, npc.rotation, npc.frame.Size() / 2f, npc.scale, spriteEffects2, 0f);
            return(false);
        }
Пример #28
0
        public override void Draw(Microsoft.Xna.Framework.GameTime time, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            var drawLocation = this.GetAbsoluteLocation(BufferWidth);
            var x            = drawLocation.X;
            var y            = drawLocation.Y;

            // Draw Text
            for (int i = 0; i < Text.Count - drawStart; i++)
            {
                if (i + drawStart != SelectedItem)
                {
                    spriteBatch.DrawString(Font, Text[(i + drawStart)],
                                           new Vector2(x, y + _cellHeight * i), NormalColor);
                }

                if (_cellHeight * (i + 1) > this.TextZoneSize.Height)
                {
                    break;
                }
            }

            // Highlight Selection
            DrawText(spriteBatch, Font, Text[SelectedItem],
                     new Vector2(x, y + _cellHeight * (SelectedItem - drawStart)), SelectionColor);

            base.Draw(time, spriteBatch);
        }
Пример #29
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(background, drawRect, Color.White);
            spriteBatch.End();
            spriteBatch.Begin();
            GraphicsDevice g = spriteBatch.GraphicsDevice;
            Viewport defaultViewport = g.Viewport;
            Viewport drawViewport = defaultViewport;
            drawViewport.X = drawRect.X;
            drawViewport.Y = drawRect.Y;
            drawViewport.Width = drawRect.Width;
            drawViewport.Height = drawRect.Height;
            g.Viewport = drawViewport;

            GraphicsDevice graphics = spriteBatch.GraphicsDevice;
            graphics.DepthStencilState = DepthStencilState.Default;

            if (model != null)
            {
                model.Draw(camera, info);
            }
            g.Viewport = defaultViewport;
            if (isConflict)
            {
                spriteBatch.Draw(ngTexture, drawRect, Color.White);
            }
        }
 public void Render(Microsoft.Xna.Framework.Graphics.SpriteBatch sb, String passID = "")
 {
     if (Selecting)
     {
         sb.Draw(m_Image, Box.FixCorners(), new Color(new Vector4(Color.DarkGreen.ToVector3(), 150)));
     }
 }
Пример #31
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            map = new Map();
            map.Load(Content);
        }
        public void Draw(SpriteBatch spriteBatch)
        {
            var player = ((SceneMap)SceneManager.Instance.GetCurrentScene()).Player;

            // Draw the hearts
            for (var i = 0; i < player.HP; i++)
            {
                spriteBatch.Draw(TextureRegion.Texture,
                    _position + _hearthSpritePosition + (Vector2.UnitX * i * (_heartSprite.Width + 2)), _heartSprite, Color.White);
            }

            // Draw the lives
            for (var i = 0; i < player.Lives; i++)
            {
                spriteBatch.Draw(TextureRegion.Texture,
                    _position + _lifeSpritePosition + (Vector2.UnitX * i * (_lifeSprite.Width + 2)), _lifeSprite, Color.White);
            }

            // Draw the ammo
            spriteBatch.Draw(TextureRegion.Texture, _position + _gunSpritePosition, _gunSprite, Color.White);
            spriteBatch.DrawString(SceneManager.Instance.GameFont, player.Ammo.ToString(),
                _position + _gunSpritePosition + (Vector2.UnitX * (_gunSprite.Width + 2)), _ammoTextColor);

            // Draw the coins
            spriteBatch.Draw(TextureRegion.Texture, _coinsPosition, _coinSprite, Color.White);
            spriteBatch.DrawString(SceneManager.Instance.GameFont, player.Coins.ToString(), 
                _coinsPosition + new Vector2(_coinSprite.Width + 3, 1), _coinsTextColor);
        }
Пример #33
0
 public void Draw(SpriteBatch spriteBatch)
 {
     foreach (Sprite star in stars)
     {
         star.Draw(spriteBatch);
     }
 }
Пример #34
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     sounds.Add(new SoundPlayer(@"./Content/Sound/s1.wav"));
     sounds.Add(new SoundPlayer(@"./Content/SampleBMS/1A#6.wav"));
 }
        public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Vector2 position, SpriteEffects spriteEffects)
        {
            if (Animation == null)
            {
                throw new NotSupportedException("No animation is currently playing.");
            }

            time += (float)gameTime.ElapsedGameTime.TotalSeconds;
            while (time > Animation.frameTime)
            {
                time -= Animation.frameTime;

                if (Animation.isLooping)
                {
                    frameIndex = (frameIndex + 1) % Animation.FrameCount;

                }
                else
                {
                    frameIndex = Math.Min(frameIndex + 1, Animation.FrameCount - 1);
                }
            }

            Rectangle source = new Rectangle(FrameIndex * Animation.FrameWidth, 0, Animation.FrameWidth, Animation.FrameHeight);

            spriteBatch.Draw(animation.texture, position, source, Color.White, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0.0f);
        }
Пример #36
0
 public void Draw(SpriteBatch spriteBatch)
 {
     
     if (id == 0)               // if id if air then return
        return;
     spriteBatch.Draw(Sprite.sprite.tileSet,bound, tile[index],color,0.0f,Vector2.Zero,effect,0f);
 }
Пример #37
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
        }
Пример #38
0
        public virtual void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            Vector2 _position2 = new Vector2(_position.X, _position.Y + 150);
            Vector2 _position3 = new Vector2(_position.X, _position.Y + 300);

            if (pause)
            {
                spriteBatch.Draw(_texture, Vector2.Zero, Color.White);

                if (jouerIn)
                    spriteBatch.Draw(jouer, _position, Color.Blue);
                else
                    spriteBatch.Draw(jouer, _position, Color.White);

                if (OptionIn)
                    spriteBatch.Draw(options, _position2, Color.Blue);
                else
                    spriteBatch.Draw(options, _position2, Color.White);

                if (QuitterIn)
                    spriteBatch.Draw(quitter, _position3, Color.Blue);
                else
                    spriteBatch.Draw(quitter, _position3, Color.White);

            }
        }
Пример #39
0
 public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
 {
     foreach (var item in _objectsList)
     {
         item.Draw(batch);
     }
 }
Пример #40
0
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            base.Draw(gameTime, spriteBatch);

            float alpha = 1 - ((float)splashTimer / 1000f);

            spriteBatch.Draw(opacity_Effect, new Rectangle(0, 0, (int)(1920 * Game1.displayRatio.X), (int)(1080 * Game1.displayRatio.Y)), new Color(255, 255, 255, alpha));
        }
Пример #41
0
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            base.Draw(gameTime, spriteBatch);

            levelSpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, null, level.Camera.GetTransformMatrix());
            level.Draw(levelSpriteBatch);
            levelSpriteBatch.End();
        }
Пример #42
0
        public override bool PreDrawInInventory(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
        {
            Texture2D texture = Main.itemTexture[item.type];

            //Texture2D texture = mod.GetTexture("Items/"+TypeNames[type-1]+(this.GetType().Name.Remove(0, 4)));
            Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + item.width * 0.5f, item.position.Y - Main.screenPosition.Y + item.height - texture.Height * 0.5f + 2f), new Rectangle(0, 0, texture.Width, texture.Height), Color.White, 0, texture.Size() * 0.5f, scale, SpriteEffects.None, 0f);
            return(false);
        }
Пример #43
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch _spritebatch)
 {
     base.Draw(_spritebatch);
     if (this.STATUS == Yugioh_AtemReturns.STATUS.TRIBUTE)
     {
         m_yellow_circle.Draw(_spritebatch);
     }
 }
 public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
 {
     if (!SGAConfigClient.Instance.LavaBlending)
     {
         DrawLava();
     }
     return(false);
 }
Пример #45
0
 private SpriteBatchDrawer(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Transform transform)
 {
     SpriteBatch = spriteBatch;
     //_offset = offset;
     //LocalOffset = localOffset;
     Transform = transform;
     _isChild  = true;
 }
Пример #46
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, GameTime gameTime)
 {
     base.Draw(spriteBatch, gameTime);
     foreach (XnaControl control in this.Children)
     {
         control.Draw(spriteBatch, gameTime);
     }
 }
Пример #47
0
        public override void Draw(GameTime time, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            UIManager.Draw(time, spriteBatch); // Draws GUI stuff

            // Draw Actors
            _world.ForEach(
                actor => ((IMovingBoxDemoObject)actor).Draw(time, spriteBatch));
        }
Пример #48
0
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            base.Draw(gameTime, spriteBatch);

            spriteBatch.DrawString(scoreFont, score.ToString(), scorePos, Color.White);
            spriteBatch.Draw(homeTex, new Vector2(70.0f, 650.0f), Color.White);
            spriteBatch.Draw(replayTex, new Vector2(820.0f, 650.0f), Color.White);
        }
Пример #49
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
        {
            Texture2D texture = Main.npcTexture[npc.type];
            Vector2   origin  = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f);

            Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition, new Rectangle?(), drawColor, npc.rotation, origin, npc.scale, SpriteEffects.None, 0);
            return(false);
        }
Пример #50
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D texture = ModLoader.GetTexture("Gyrolite/Projectiles/Summoner/AjiwrenchMinion" + (int)projectile.ai[0]);
            Vector2   origin  = new Vector2((float)texture.Width * 0.5f, (float)texture.Height * 0.5f);

            spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(), Color.White * 0.75F, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0);
            return(false);
        }
Пример #51
0
 public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
 {
     foreach (GuardianDrawData dd in GetDrawDatas(drawColor, false))
     {
         dd.Draw(spriteBatch);
     }
     return(false);
 }
Пример #52
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sprite)
 {
     //base.Draw(sprite);
     sprite.Begin();
     sprite.Draw(texture, drawVector, Color.White);
     sprite.Draw(texture, drawVector + new Vector2(width / 2, height / 2), null, Color.White, -degree, new Vector2(width / 2, height / 2), new Vector2(1, 1), SpriteEffects.None, 0);
     //sprite.Draw(texture, drawVector + new Vector2(-48,-48), null, Color.White, -degree, new Vector2(48,48), new Vector2(1, 1), SpriteEffects.None, 0);
     sprite.End();
 }
Пример #53
0
        /// <summary>
        /// TO DO
        ///
        /// Remove the switch case and replace it with a list of menu items instead
        /// </summary>
        /// <param name="spriteBatch"></param>
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            foreach (MenuItem item in menuItems)
            {
                item.Draw(spriteBatch);
            }

            base.Draw(spriteBatch);
        }
Пример #54
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
 {
     sb.Draw(texture, area, color);
     if (state)
     {
         sb.Draw(checkTexture, area, color);
     }
     sb.DrawString(Fonts.Arial, name, labelPos, color);
 }
Пример #55
0
        public void LoadGraphicsContentLife(Microsoft.Xna.Framework.Graphics.SpriteBatch sprite, Microsoft.Xna.Framework.Graphics.Texture2D texture)
        {
            foreach (Image life in lifes)
            {
                life.LoadGraphicsContent(sprite, texture);
            }

            lifetext = lifes[0].Texture;
        }
Пример #56
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
 {
     sb.Draw(
         texture,
         new Rectangle(0, 0, Settings.Size.WIDTH, Settings.Size.HEIGHT),
         new Rectangle((int)camera.X, (int)camera.Y, Settings.Size.WIDTH, Settings.Size.HEIGHT),
         Color.White
         );
 }
Пример #57
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            base.Draw(sb);

            if (!ragdoll.asleep)
            {
                DrawStabilizerThrusters(sb);
            }
        }
Пример #58
0
        /// <summary>
        /// Рисуем панель по вектору
        /// </summary>
        /// <param name="spriteBatch">The sprite batch.</param>
        /// <param name="location">Вектор</param>
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Microsoft.Xna.Framework.Vector2 location)
        {
            int       width                = _Texture.Width;
            int       height               = _Texture.Height;
            Rectangle sourceRectangle      = new Rectangle(width, height, width, height);
            Rectangle destinationRectangle = new Rectangle((int)location.X, (int)location.Y, width, height);

            spriteBatch.Draw(_Texture, destinationRectangle, sourceRectangle, Color.White);
        }
Пример #59
0
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            base.Draw(gameTime, spriteBatch);

            spriteBatch.Draw(logoTex, new Vector2(320.0f, 200.0f), Color.White);
            spriteBatch.Draw(websiteTex, new Vector2(70.0f, 650.0f), Color.White);
            spriteBatch.Draw(creditsTex, new Vector2(112.0f, 50.0f), Color.White);
            spriteBatch.Draw(continueTex, new Vector2(820.0f, 650.0f), Color.White);
        }
Пример #60
0
        public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Microsoft.Xna.Framework.Vector2 location)
        {
            Rectangle destinationRectangle = new Rectangle((int)location.X, (int)location.Y,
                                                           (int)BlockSpriteConstants.GENERICBLOCKDIMENSIONS.X, (int)BlockSpriteConstants.GENERICBLOCKDIMENSIONS.Y);

            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenScaler.ScalingMatrix);
            spriteBatch.Draw(spriteSheet, destinationRectangle, sourceRectangle, Color.White);
            spriteBatch.End();
        }