Draw() 공개 메소드

Submit a sprite for drawing in the current batch.
public Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, System.Color color ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D A texture.
destinationRectangle Rectangle The drawing bounds on screen.
color System.Color A color mask.
리턴 void
예제 #1
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, _rasterizerScissorsState);

            sb.Draw(frameText, new Rectangle(X, Y, width, height), Color.White);

            //if (new Rectangle(X, Y, width, height).Contains((int)GUI.InputManager.MousePosition.X, (int)GUI.InputManager.MousePosition.Y))
            //    if(GUI.InputManager.MouseManager.State.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            //        sb.Draw(backText, ClientArea, Color.Gray);
            //    else
            //        sb.Draw(backText, ClientArea, Color.LightGray);
            //else

            sb.Draw(backText, ClientArea, topColor);
            topColor = Color.White;

            Rectangle oldsc = sb.GraphicsDevice.ScissorRectangle;

            sb.GraphicsDevice.ScissorRectangle = ClientArea;

            sb.DrawString(Parent.Font, drawText, new Vector2(ClientArea.X + 3, ClientArea.Y + 3 - text_y_scroll), Color.Black); //, 0, Vector2.Zero, 1f, SpriteEffects.None, 0);
            //sb.DrawString(font, drawString, new Vector2(destination.X, destination.Y - yoffset), color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0);

            sb.GraphicsDevice.ScissorRectangle = oldsc;

            sb.End();
        }
예제 #2
0
        public void Draw(SpriteBatch spriteBatch, Camera camera)
        {
            #region Draw held animations

            if (Player != null)
            {
                spriteBatch.Draw(WeaponTexture, Player.Movement.Area, Color.White);
            }

            #endregion

            #region Draw live weapons

            foreach (var weapon in LiveWeapons)
            {
                if (weapon.Weapon.Type.Name == "Sword")
                {
                    Vector2 center = new Vector2(weapon.Weapon.Sprite.Center.X, weapon.Weapon.Sprite.Bottom);
                    spriteBatch.Draw(WeaponTexture, camera.FromRectangle(new Rectangle((int)weapon.Location.X, (int)weapon.Location.Y, weapon.Weapon.Sprite.Width, weapon.Weapon.Sprite.Height)), weapon.Weapon.Sprite, Color.White, weapon.Rotation, center, SpriteEffects.None, 0);
                    // Draw hitboxes
                    //spriteBatch.Draw(WeaponTexture, camera.FromRectangle(new Rectangle((int)weapon.currentLocation.UpperLeftCorner().X, (int)weapon.currentLocation.UpperLeftCorner().Y, 5, 5)), Color.White);
                    //spriteBatch.Draw(WeaponTexture, camera.FromRectangle(new Rectangle((int)weapon.currentLocation.UpperRightCorner().X, (int)weapon.currentLocation.UpperRightCorner().Y, 5, 5)), Color.White);
                    //spriteBatch.Draw(WeaponTexture, camera.FromRectangle(new Rectangle((int)weapon.currentLocation.LowerLeftCorner().X, (int)weapon.currentLocation.LowerLeftCorner().Y, 5, 5)), Color.White);
                    //spriteBatch.Draw(WeaponTexture, camera.FromRectangle(new Rectangle((int)weapon.currentLocation.LowerRightCorner().X, (int)weapon.currentLocation.LowerRightCorner().Y, 5, 5)), Color.White);
                }
                else if (weapon.Weapon.Type.Name == "Arrow")
                {
                    float angle = (float)Geometry.Angle(Vector2.Zero, weapon.Movement.Velocity);
                    spriteBatch.Draw(ArrowTexture, camera.FromRectangle(weapon.Movement.Area), ArrowTexture.Bounds, Color.White, MathHelper.ToRadians(angle + 90f), new Vector2(weapon.Movement.Area.Width / 2, weapon.Movement.Area.Height / 2), SpriteEffects.None, 0);
                }
            }

            #endregion
        }
        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);
        }
예제 #4
0
 public void Draw(SpriteBatch spriteBatch, GameTime time)
 {
     if(active && (this is Player || this is Enemy || this is Rock))
         spriteBatch.Draw(texture, position, new Rectangle(0,0,texture.Width,texture.Height), color, rotation, Vector2.Zero, scale, spriteEffects, depth);
     if(active && this is Shoot)
         spriteBatch.Draw(texture, position, new Rectangle(0, 0,texture.Width,texture.Height), color, rotation, Vector2.Zero, scale, spriteEffects, depth);
 }
예제 #5
0
        public override void DrawInContainer(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, SignsOfLife.UI.Containers.Container container, Color tintColor, Color behindTint)
        {
            Vector2   position         = new Vector2((float)this._localPosX * Container.CONTAINER_SCALE_VECTOR.X + container.X, (float)this._localPosY * Container.CONTAINER_SCALE_VECTOR.Y + container.Y);
            Rectangle noChargedOverlay = new Rectangle((int)position.X, (int)position.Y, _rectSourceNoPower.Width, _rectSourceNoPower.Height);
            Rectangle chargedOverlay   = noChargedOverlay;
            Rectangle chargedSource    = _rectSourcePowered;
            int       diff             = (int)((float)chargedOverlay.Height * (Charge / MaxCharge));

            chargedOverlay.Y     += chargedOverlay.Height - diff;
            chargedOverlay.Height = diff;
            chargedSource.Y      += chargedSource.Height - diff;
            chargedSource.Height  = diff;
            //

            SpriteEffects effects = SpriteEffects.None;

            if (base.IsFlipped)
            {
                effects = SpriteEffects.FlipHorizontally;
            }
            if (this._amount == 1)
            {
                spriteBatch.Draw(this._texture, noChargedOverlay, new Rectangle?(_rectSourceNoPower), tintColor, 0f, Vector2.Zero, effects, 0f);
                spriteBatch.Draw(this._texture, chargedOverlay, new Rectangle?(chargedSource), tintColor, 0f, Vector2.Zero, effects, 0f);
                return;
            }
            spriteBatch.Draw(this._texture, position + new Vector2(this.MULTIPLE_QUANTITY_SHIFT, 0), new Rectangle?(this._spriteBounds), behindTint, 0f, Vector2.Zero, Container.CONTAINER_SCALE_VECTOR, effects, 0f);
            spriteBatch.Draw(this._texture, position, new Rectangle?(this._spriteBounds), tintColor, 0f, Vector2.Zero, Container.CONTAINER_SCALE_VECTOR, effects, 0f);
        }
예제 #6
0
        public void DrawStandardButton(SpriteBatch spriteBatch, Point position, string text, Color color, int forcedLength = 0)
        {
            SpriteFont font = Resources.Menus.ButtonFont;
            if (customFont != null) font = customFont;
            int buttonHeight = 48;
            int endWidth = 36;
            int centerWidth = 16;
            Rectangle dimensions = new Rectangle(position.X, position.Y, endWidth, buttonHeight);
            Texture2D texture = Resources.Menus.ButtonLeft;
            spriteBatch.Draw(texture, dimensions, color);

            texture = Resources.Menus.ButtonCenter;
            Vector2 stringDimensions = font.MeasureString(text);
            int i = endWidth;
            for (; i < endWidth + Math.Max(stringDimensions.X, forcedLength); i += centerWidth)
            {
                dimensions = new Rectangle(position.X + i, position.Y, centerWidth, buttonHeight);
                spriteBatch.Draw(texture, dimensions, color);
            }
            texture = Resources.Menus.ButtonRight;
            dimensions = new Rectangle(position.X + i, position.Y, endWidth, buttonHeight);
            spriteBatch.Draw(texture, dimensions, color);
            spriteBatch.DrawString(font, text, new Vector2(position.X + endWidth, position.Y), ColorMul(engravingColor2, color));
            spriteBatch.DrawString(font, text, new Vector2(position.X + endWidth + 1, position.Y + 1), ColorMul(engravingColor1, color));
        }
예제 #7
0
 public override void Render(SpriteBatch spriteBatch)
 {
     if (this.bRenderShadow)
     {
         if (this.bCustomShadow)
         {
             spriteBatch.Draw(this.txShadowTexture, Utility.Vector2_ToInts(this.xTransform.v2Pos) - this.xCamera.v2TopLeft, null, this.cColor * this.fAlpha, 0f, this.v2Offset, base.fScale, SpriteEffects.None, 0f);
         }
         else
         {
             spriteBatch.Draw(ItemRenderComponent.txGenericShadow, Utility.Vector2_ToInts(this.xTransform.v2Pos) - this.xCamera.v2TopLeft, null, this.cColor * 0.6f, 0f, ItemRenderComponent.v2ShadowOffset, 1f, SpriteEffects.None, 0f);
         }
     }
     if (base.xEffectWrapper == null)
     {
         spriteBatch.Draw(this.txTexture, Utility.Vector2_ToInts(this.xTransform.v2Pos + this.v2OffsetRenderPos) - this.xCamera.v2TopLeft, null, this.cColor * this.fAlpha, this.fRotation, this.v2Offset, base.fScale, SpriteEffects.None, 0f);
         return;
     }
     spriteBatch.End();
     foreach (KeyValuePair<string, float> kvp in this.dsfFloatShaderParameters)
     {
         base.xEffectWrapper.xEffect.Parameters[kvp.Key].SetValue(kvp.Value);
     }
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null, base.xEffectWrapper.xEffect);
     spriteBatch.Draw(this.txTexture, Utility.Vector2_ToInts(this.xTransform.v2Pos + this.v2OffsetRenderPos) - this.xCamera.v2TopLeft, null, this.cColor * this.fAlpha, this.fRotation, this.v2Offset, base.fScale, SpriteEffects.None, 0f);
     spriteBatch.End();
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null);
 }
예제 #8
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);
            }
        }
예제 #9
0
 public static void DrawBorder(SpriteBatch sb, Texture2D border, XNARectangle rectangle, float transparency = 1.0f)
 {
     sb.Draw(border, new XNARectangle(rectangle.X, rectangle.Y, rectangle.Width, 1), Color.White * transparency); // Top
     sb.Draw(border, new XNARectangle(rectangle.X, rectangle.Y, 1, rectangle.Height), Color.White * transparency); // Left
     sb.Draw(border, new XNARectangle(rectangle.X, rectangle.Y + rectangle.Height - 1, rectangle.Width, 1), Color.White * transparency); // Bottom
     sb.Draw(border, new XNARectangle(rectangle.X + rectangle.Width - 1, rectangle.Y, 1, rectangle.Height), Color.White * transparency); // Right
 }
예제 #10
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(TitleScreenTexture, Vector2.Zero, null, backgroundCurrentColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f);
            spriteBatch.Draw(TitleTextJapanese, Vector2.Zero, null, text1CurrentColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, .9f);
            spriteBatch.Draw(TitleTextEnglish, Vector2.Zero, null, text2CurrentColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, .8f);

            if(!HelpShown && !CreditsShown)
                spriteBatch.DrawString(titlescreenFont, "Press ENTER to begin", new Vector2((925f / 2f) - (titlescreenFont.MeasureString("Press ENTER to begin").X / 2f), 500), startTextColor);

            if (fadephase == 2 && !HelpShown && !CreditsShown)
            {
                spriteBatch.DrawString(titlescreenFont, "Press C for credits", new Vector2((925f) - (titlescreenFont.MeasureString("Press C for credits").X + 30), 605), Color.Gray);
                spriteBatch.DrawString(titlescreenFont, "Press H for help", new Vector2((925f) - (titlescreenFont.MeasureString("Press H for help").X + 30), 620), Color.Gray);
            }

            if (HelpShown)
            {
                spriteBatch.Draw(HelpTexture, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
            }
            else if (CreditsShown)
            {
                spriteBatch.Draw(CreditsTexture, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
            }

            spriteBatch.DrawString(titlescreenFont, cheatText, new Vector2((925f / 2f) - (titlescreenFont.MeasureString(cheatText).X / 2f), 600), cheatTextCurrentColor);
        }
예제 #11
0
        public void Draw(SpriteBatch sprBatch)
        {
            //draw the datas texture
            sprBatch.Draw(data.Value.texture,new Rectangle(parent.ScreenWidth/2-200,parent.ScreenHeight/2-400,400,400),Color.White);
            //draw the left level
            if (data.Previous != null)
            {
                sprBatch.Draw(data.Previous.Value.texture, new Rectangle(parent.ScreenWidth / 2 - 400, parent.ScreenHeight / 2 - 400, 200, 200), Color.White);
            }
            else
            {
                sprBatch.Draw(levelData.Last.Value.texture, new Rectangle(parent.ScreenWidth / 2 - 400, parent.ScreenHeight / 2 - 400, 200, 200), Color.White);
            }

            if(data.Next != null)
            {
                sprBatch.Draw(data.Next.Value.texture, new Rectangle(parent.ScreenWidth / 2 +200, parent.ScreenHeight / 2 - 400, 200, 200), Color.White);
            }
            else
            {
                sprBatch.Draw(levelData.First.Value.texture, new Rectangle(parent.ScreenWidth / 2 + 200, parent.ScreenHeight / 2 - 400, 200, 200), Color.White);
            }
            //draw the text
            sprBatch.DrawString(font, data.Value.name, new Vector2(parent.ScreenWidth / 2 - (font.MeasureString(data.Value.name).X / 2), parent.ScreenHeight / 2), Color.Yellow);
            selection.draw(sprBatch);
        }
예제 #12
0
		protected override void DrawSelf(SpriteBatch spriteBatch)
		{
			base.DrawSelf(spriteBatch);
			CalculatedStyle space = GetInnerDimensions();
			spriteBatch.Draw(Main.magicPixel, new Rectangle((int)space.X + 10, (int)space.Y + (int)space.Height / 2 + 20, (int)space.Width - 20, 10), new Rectangle(0, 0, 1, 1), new Color(0, 0, 70));
			spriteBatch.Draw(Main.magicPixel, new Rectangle((int)space.X + 10, (int)space.Y + (int)space.Height / 2 + 20, (int)((space.Width - 20) * progress), 10), new Rectangle(0, 0, 1, 1), new Color(200, 200, 70));
		}
예제 #13
0
 public void draw(SpriteFont font, SpriteBatch batch, Texture2D score, Texture2D health)
 {
     batch.DrawString(font, hudScore, hudPosition, Color.White);
     batch.DrawString(font, hudHealth, new Vector2(hudPosition.X + 270, hudPosition.Y), Color.White);
     batch.Draw(score, new Vector2(hudPosition.X - 20, hudPosition.Y - 16), Color.White);
     batch.Draw(health, new Vector2(hudPosition.X + 220, hudPosition.Y - 17), Color.White);
 }
예제 #14
0
        public void DrawGridContent(SpriteBatch spriteBatch, Texture2D texture)
        {
            for (int x = 0; x < CountX; x++)
            {
                for (int y = 0; y < CountY; y++)
                {
                    GridEntity currentGrid = GridBox[x, y];

                    switch (currentGrid.Status)
                    {
                        case GridStatus.Mouseover:
                            spriteBatch.Draw(texture, currentGrid.Rect, MouseoverColor);
                            break;
                        case GridStatus.Occupied:
                            spriteBatch.Draw(texture, currentGrid.Rect, OccupiedColor);
                            break;
                        case GridStatus.Vacant:
                            spriteBatch.Draw(texture, currentGrid.Rect, AreaColor);
                            break;
                        case GridStatus.Selected:
                            spriteBatch.Draw(texture, currentGrid.Rect, currentGrid.Color);
                            break;
                    }
                }
            }
        }
 private void DrawLoadingCircle(float timeRemaining, float totalTime, Rectangle dest, Vector2 loaderCentre,
     float loaderRadius, float baseRotationAdd, float rotationRateRPS, SpriteBatch sb)
 {
     var num1 = totalTime - timeRemaining;
     var num2 = 10;
     for (var index = 0; index < num2; ++index)
     {
         var num3 = index/(float) num2;
         var num4 = 2f;
         var num5 = 1f;
         var num6 = 6.283185f;
         var num7 = num6 + num5;
         var num8 = num3*num4;
         if (num1 > (double) num8)
         {
             var num9 = num1/num8*rotationRateRPS%num7;
             if (num9 >= (double) num6)
                 num9 = 0.0f;
             var angle = num6*Utils.QuadraticOutCurve(num9/num6) + baseRotationAdd;
             var vector2_1 = loaderCentre + Utils.PolarToCartesian(angle, loaderRadius);
             sb.Draw(circle, vector2_1, new Rectangle?(), Utils.AddativeWhite, 0.0f, Vector2.Zero,
                 (float) (0.100000001490116*(loaderRadius/120.0)), SpriteEffects.None, 0.3f);
             if (Utils.random.NextDouble() < 0.001)
             {
                 var vector2_2 = loaderCentre + Utils.PolarToCartesian(angle, 20f + Utils.randm(45f));
                 sb.Draw(Utils.white, vector2_1, Utils.AddativeWhite);
                 Utils.drawLine(sb, vector2_1, vector2_2, Vector2.Zero, Utils.AddativeWhite*0.4f, 0.1f);
             }
         }
     }
 }
예제 #16
0
 public void DrawLeft(SpriteBatch spriteBatch, CombatNumberGenerator generator, Point start, float scale)
 {
     int x = start.X;
     spriteBatch.Draw(generator.Texture, new Vector2((float) x, start.Y - (generator.DigitHeight * scale)), new Rectangle?(generator.GetCurrentArrowRectangle(this.Kind, CombatNumberDirection.上)), Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0.649f);
     int number = this.Number;
     List<int> list = new List<int>();
     if (number == 0)
     {
         list.Add(0);
     }
     else
     {
         while (number > 0)
         {
             list.Add(number % 10);
             number /= 10;
         }
     }
     list.Reverse();
     foreach (int num3 in list)
     {
         x += (int) (generator.DigitWidth * scale);
         spriteBatch.Draw(generator.Texture, new Vector2((float) x, start.Y - (generator.DigitHeight * scale)), new Rectangle?(generator.GetCurrentDigitRectangle(this.Kind, CombatNumberDirection.上, num3)), Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0.649f);
     }
 }
 public void DrawRectangle(SpriteBatch spriteBatch, Rectangle rectangle, Color color)
 {
     spriteBatch.Draw(EmptyTexture(), new Rectangle(rectangle.X, rectangle.Y, Configuration.LineWidth, rectangle.Height + Configuration.LineWidth), color);
     spriteBatch.Draw(EmptyTexture(), new Rectangle(rectangle.X, rectangle.Y, rectangle.Width + Configuration.LineWidth, Configuration.LineWidth), color);
     spriteBatch.Draw(EmptyTexture(), new Rectangle(rectangle.X + rectangle.Width, rectangle.Y, Configuration.LineWidth, rectangle.Height + Configuration.LineWidth), color);
     spriteBatch.Draw(EmptyTexture(), new Rectangle(rectangle.X, rectangle.Y + rectangle.Height, rectangle.Width + Configuration.LineWidth, Configuration.LineWidth), color);
 }
예제 #18
0
        public override void Draw(SpriteBatch spriteBatch, GraphicsDevice graphics)
        {
            Texture2D redPixel = new Texture2D(graphics, 1, 1);
            Texture2D blackPixel = new Texture2D(graphics, 1, 1);
            Color[] redData = { Color.Red };
            Color[] blackData = { Color.Black };
            redPixel.SetData<Color>(redData);
            blackPixel.SetData<Color>(blackData);
            Rectangle healthContainer = new Rectangle((int)position.X, (int)position.Y - 10, width, 5);
            int borderWidth = 1;

            // Draw health segments inside of health container
            for (int i = 0; i < healthPoints; i++)
            {
                int segmentWidth = (int)Math.Ceiling((double)width / maxHealthPoints);
                int left = (int)position.X + (int)(i * segmentWidth);
                if (i + 1 == maxHealthPoints)
                    segmentWidth = width - (i * segmentWidth);
                Rectangle segment = new Rectangle(left, (int)position.Y - 10, segmentWidth, 5);
                spriteBatch.Draw(redPixel, segment, Color.White);
            }
            spriteBatch.Draw(blackPixel, new Rectangle(healthContainer.Left, healthContainer.Top, borderWidth, healthContainer.Height), Color.White); // Left
            spriteBatch.Draw(blackPixel, new Rectangle(healthContainer.Right, healthContainer.Top, borderWidth, healthContainer.Height), Color.White); // Right
            spriteBatch.Draw(blackPixel, new Rectangle(healthContainer.Left, healthContainer.Top, healthContainer.Width, borderWidth), Color.White); // Top
            spriteBatch.Draw(blackPixel, new Rectangle(healthContainer.Left, healthContainer.Bottom, healthContainer.Width, borderWidth), Color.White); // Bottom
        }
예제 #19
0
        public override void Draw(SpriteBatch sprite)
        {
            //draw the box
            //if hovered, show text at center
            switch (currentState)
            {
                case ButtonState.MOUSE_OUT:
                    sprite.Draw(buttonTexture, position, null, Color.Transparent, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f);
                    break;
                case ButtonState.HOVERED:
                    sprite.Draw(buttonTexture, position, null, Color.Transparent, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f);
                    //if hovered show text
                    break;
            }

            //draw the text
            if (this.showText)
            {
                switch (currentState)
                {
                    case ButtonState.MOUSE_OUT:
                        sprite.DrawString(fontStyle, label, stringPosition, Color.Black, 0f, stringOrigin, 1f, SpriteEffects.None, 0f);
                        break;
                    case ButtonState.HOVERED:
                        sprite.DrawString(fontStyle, label, stringPosition, Color.White, 0f, stringOrigin, 1f, SpriteEffects.None, 0f);
                        break;
                }
            }
        }
예제 #20
0
        public void Draw(SpriteBatch spriteBatch)
        {
            if (pressed)
            {
                int rr = c.R + 50;
                int gg = c.G + 50;
                int bb = c.B + 50;

                if (rr > 255)
                {
                    rr = c.R - 30;
                }
                if (gg > 255)
                {
                    gg = c.G - 30;
                }
                if (bb > 255)
                {
                    bb = c.B - 30;
                }

                Color pressedColor = new Color(rr, gg, bb);
                spriteBatch.Draw(texture, pos, pressedColor);

            }
            else
            {
                spriteBatch.Draw(texture, pos, c);
            }

            spriteBatch.DrawString(font, stringtosend, new Vector2(pos.X + 20, pos.Y + 20), Color.White);
        }
예제 #21
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch b)
 {
     b.Draw(this.Texture, this.RenderPosition, this.RenderRectangle, this.RenderColor, this.Rotation, this.Origin, this.Scale, this.SpriteEffects, this.LayerDepth);
     if (showBoard)
     {
         b.Draw(this.Texture, detailBoard.Pos, detailBoard.Rect, detailBoard.Color, 0, Vector2.Zero, 1, SpriteEffects.None, detailBoard.LayerDepth);
         if (!hasAddBtn)
         {
             GlobalController.buttonList.Add(new Button(ResourceController.UI_ordinary, "1", "FishNet", 0.81f, new Vector2(detailBoard.Pos.X * 2 + 12 * Define.UnitOFpixel - 8 - 16, detailBoard.Pos.Y * 2 - 8 - 16)));
             GlobalController.buttonList.Add(new Button(ResourceController.UI_ordinary, "2_2", "FishNet", 0.81f, new Vector2(detailBoard.Pos.X * 2 + 48 * 2, detailBoard.Pos.Y * 2 + 205 * 2)));
             hasAddBtn = true;
         }
         showBanner = false;
         bannerFish = Fish.Null;
         for (int i = 0; i < fishList.Count; i++)
         {
             ShowFishDetails(b, i, fishList[i]);
         }
         if (showBanner)
         {
             b.Draw(this.Texture, GlobalController.Mouse.Position / 2, new Rectangle(7 * Define.UnitOFpixel, 47 * Define.UnitOFpixel, 4 * Define.UnitOFpixel, 4 * Define.UnitOFpixel), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, detailBoard.LayerDepth + 0.003f);
             b.Draw(bannerFish.Texture, new Vector2(GlobalController.Mouse.Position.X / 2 + 7, GlobalController.Mouse.Position.Y / 2 + 6), bannerFish.RenderRectangle, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, detailBoard.LayerDepth + 0.004f);
             Fonts.DrawSysFont(bannerFish.Name, new Vector2(GlobalController.Mouse.Position.X / 2 + 37, GlobalController.Mouse.Position.Y / 2 + 6), b, Color.Black, detailBoard.LayerDepth + 0.004f, 0.5f, 30);
         }
     }
 }
예제 #22
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            if (this.Health != this.MaxHealth)
            {
                var healthPercent = (float)this.Health / this.MaxHealth;
                var healthBarWidth = (int)(100 * healthPercent);
                var healthBar = new Rectangle(((int)this.BoundingBoxX + this.BoundingBox.Width / 2) - 50,
                    (int)this.Position.Y - 20,
                    healthBarWidth,
                    10);

                var healthBarEmpty = new Rectangle(
                this.BoundingBox.X + (this.BoundingBox.Width / 2) - 50,
                (int)this.Position.Y - 20,
                100,
                10);

                spriteBatch.Draw(TextureLoader.TheOnePixel, healthBarEmpty, Color.LightBlue * 0.8f);

                if (healthPercent < 0.4f)
                {
                    spriteBatch.Draw(TextureLoader.TheOnePixel, healthBar, null, Color.Red);
                }
                else
                {
                    spriteBatch.Draw(TextureLoader.TheOnePixel, healthBar, null, Color.Green);
                }
            }
            spriteBatch.Draw(this.SpriteSheet, this.Position, this.SourceRect, Color.White);
        }
예제 #23
0
        public void DrawObject(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, SkeletonMeshRenderer meshRenderer, GameTime gameTime,
                               int mapShiftX, int mapShiftY, bool flip, ReflectionDrawableBoundary drawReflectionInfo)
        {
            int drawX = X - mapShiftX;
            int drawY = Y - mapShiftY;

            spriteBatch.Draw(texture,
                             new Rectangle(drawX, drawY, texture.Width, texture.Height),
                             null,                                                       // src rectangle
                             Color.White,                                                // color
                             0f,                                                         // angle
                             new Vector2(0f, 0f),                                        // origin
                             flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, // flip
                             0f                                                          // layer depth
                             );

            if (drawReflectionInfo != null && drawReflectionInfo.Reflection)
            {
                const float reflectionAngle = 0f; // using flip instead of angle
                // TODO gradient in an optimized way.. hm

                spriteBatch.Draw(texture,
                                 new Rectangle(drawX, drawY, texture.Width, texture.Height),
                                 null, // src rectangle
                                 _REFLECTION_OPACITY_COLOR,
                                 reflectionAngle,
                                 new Vector2(0, -texture.Height), // origin
                                 flip ? SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically : SpriteEffects.None | SpriteEffects.FlipVertically,
                                 0f                               // layer depth
                                 );
            }
        }
예제 #24
0
 public void Draw(SpriteBatch batch)
 {
     batch.Draw(_socketSprite.Texture, _center, null, Color.White, 0f,
                _socketSprite.Origin, 1f, SpriteEffects.None, 0f);
     batch.Draw(_stickSprite.Texture, _position, null, Color.White, 0f,
                _stickSprite.Origin, 1f, SpriteEffects.None, 0f);
 }
예제 #25
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            if (rangeTexture == null)
            {
                return;
            }
            if (collisionTexture == null)
            {
                return;
            }

            Rectangle rangeCollisionRangeRectangle = getRangeCollisionRange();

            rangeCollisionRangeRectangle.X -= (int)TheGame.Instance.map.Pos.X;
            if (TheGame.Instance.isDebug)
            {
                spriteBatch.Draw(rangeTexture, rangeCollisionRangeRectangle, Color.White);
            }

            base.Draw(spriteBatch);

            Rectangle headCollisionRectangle = getHeadCollisionRectangle();

            headCollisionRectangle.X -= (int)TheGame.Instance.map.Pos.X;
            if (TheGame.Instance.isDebug)
            {
                spriteBatch.Draw(collisionTexture, headCollisionRectangle, Color.White);
            }
        }
예제 #26
0
파일: Punticos.cs 프로젝트: jmtt89/Pacmando
        public void Draw(SpriteBatch batch)
        {
            int count = 0;
            for (int i = 0; i < Pos.GetLength(0); i++)
            {
                for (int j = 0; j < Pos.GetLength(1); j++)
                {
                    if (Pos[i, j] == 1)
                    {
                        Vector2 sourceCrump = new Vector2((int)(Rec.X + DimX * j + DimX / 2), (int)(Rec.Y + DimY * i + DimX / 2));
                        batch.Draw(Crump, sourceCrump, Color.White);
                    }
                    if (Pos[i, j] == 3)
                    {
                        Vector2 sourceCrump = new Vector2((int)(Rec.X + DimX * j + DimX / 2), (int)(Rec.Y + DimY * i + DimX / 2));
                        batch.Draw(SCrump, sourceCrump, Color.White);

                    }
                    if (Pos[i, j] == 2 && !Comida && aparece)
                    {
                        if (count == 16)
                        {

                            PosBono = new Vector2((int)(Rec.X + DimX * j ), (int)(Rec.Y + DimY * (i+2))-5);
                            batch.Draw(Bono, PosBono, Color.White);
                        }
                        count++;
                    }

                }
            }
        }
예제 #27
0
        protected override void InternalDraw(Microsoft.Xna.Framework.GameTime gameTime, SpriteBatch batch)
        {
            //画其他
            //batch.Draw(((BigSnake)m_unit).Smoke, Locate, null, ((BigSnake)m_unit).Color, ((BigSnake)m_unit).Rotation, new Vector2(160f), 1, SpriteEffects.None, 0);
            batch.Draw(((BigSnake)m_unit).HeadElec, Locate, null, ((BigSnake)m_unit).Color, ((BigSnake)m_unit).Rotation, new Vector2(160f), m_worldManager.Scale * m_unit.EnemySize * 0.8f, SpriteEffects.None, 0);

            //画骨节
            foreach (var ptr in ((BigSnake)m_unit).BodyNodeList)
            {
                batch.Draw(ptr.RightGlass.Target[(int)ptr.RightGlass.CurrentStatus],
                          (ptr.RightGlass.Postion - m_worldManager.Locate) * m_worldManager.Scale + m_worldManager.Space / 2, null, ptr.Color, ptr.Rotation,
                           new Vector2(75, 40), m_worldManager.Scale * m_unit.EnemySize * 0.8f, SpriteEffects.None, 0);
                batch.Draw(ptr.LeftGlass.Target[(int)ptr.LeftGlass.CurrentStatus],
                          (ptr.LeftGlass.Postion - m_worldManager.Locate) * m_worldManager.Scale + m_worldManager.Space / 2, null, ptr.Color, ptr.Rotation,
                           new Vector2(75, 40), m_worldManager.Scale * m_unit.EnemySize * 0.8f, SpriteEffects.None, 0);
                batch.Draw(ptr.Target, (ptr.Postion - m_worldManager.Locate) * m_worldManager.Scale + m_worldManager.Space / 2, null, ptr.Color, ptr.Rotation,
                          new Vector2(160f), m_worldManager.Scale*m_unit.EnemySize * 0.8f, SpriteEffects.None, 0);
            }

            //画头
            batch.Draw(((BigSnake)m_unit).Head[(int)((BigSnake)m_unit).CurrentStatus], Locate, null, ((BigSnake)m_unit).Color, ((BigSnake)m_unit).Rotation, new Vector2(160f), m_worldManager.Scale * m_unit.EnemySize *1.4f, SpriteEffects.None, 0);

            //画血
            batch.Draw(((BigSnake)m_unit).HeadHP[(int)((BigSnake)m_unit).CurrentStatus], Locate, null, ((BigSnake)m_unit).Color, ((BigSnake)m_unit).Rotation, new Vector2(160f), m_worldManager.Scale * m_unit.EnemySize*1.4f, SpriteEffects.None, 0);
        }
예제 #28
0
        public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            Vector2 offset = new Vector2(ConvertUnits.ToDisplayUnits(Position.X) - width / 2, ConvertUnits.ToDisplayUnits(Position.Y) - height / 2);

            int xpos = 30 + (frameIndex * frameSize);
            int ypos;

            if (state == RobotState.IDLE)
            {
                ypos = 285;
            }
            else
            {
                ypos = 410;
            }

            srcRect = new Rectangle(xpos, ypos, width, height);

            if (direction == PlayerDirection.LEFT)
            {
                sb.Draw(this.texture, offset, srcRect, Color.White, Rotation, new Vector2(0, 0), 1.0f, SpriteEffects.None, 1.0f);
            }
            else
            {
                sb.Draw(this.texture, offset, srcRect, Color.White, Rotation, new Vector2(0, 0), 1.0f, SpriteEffects.FlipHorizontally, 1.0f);
            }
        }
예제 #29
0
파일: Playing.cs 프로젝트: Bonemind/pulsed
        //Actual game, health checking, and update healthbar.
        public void Draw(SpriteBatch spriteBatch)
        {
            if (gameStarted)
            {

                score.Draw(spriteBatch);
                slider.Draw(spriteBatch);
                if (disconnected)
                {
                    spriteBatch.DrawString(font, "DISCONNECTED", new Vector2(1000, 500), Color.Red);
                }

                //takes care of drawing the health in the form of hearts, every hearth represents 25% health
                int hearts = (int)Math.Ceiling((double)dummy.Health / 25);
                //Loops throught the number of full hearts that should be rendered, moving every heart 100px forward
                for (int i = 0; i < hearts; i++)
                {
                    spriteBatch.Draw(HeartFull, new Vector2(20 + (i * 100), 20), Color.White);
                }
                //draws the empty hearts, moves from the right to the left, decreasing the posistion of every heart by 100px
                for (int i = hearts; i <= 3; i++)
                {
                    spriteBatch.Draw(HeartEmpty, new Vector2(320 - ((3 - i) * 100), 20), Color.White);

                }
            }
            else
            {
                    spriteBatch.DrawString(font, "Druk op de knop op de pop", new Vector2(1000, 500), Color.Black);
            }
        }
예제 #30
0
        public override void Draw(SpriteBatch sb)
        {
            GraphicsDevice.Clear(Color.White);
            base.Draw(sb);

            Viewport vp = GraphicsDevice.Viewport;
            Vector2 catGirlStart = new Vector2(-vp.Width / 2, vp.Height * 0.75f).Floor();
            Vector2 catGirlEnd = catGirlStart + new Vector2(vp.Width, 0);

            string text = string.Format(format,
                    (double)TimeSpan.TicksPerSecond / (double)Game.TargetElapsedTime.Ticks,
                    start.ToLongTimeString(), actualTime.ToLongTimeString(), calculatedTime.ToLongTimeString(),
                    calculatedTime - actualTime,
                    (calculatedTime - actualTime).TotalSeconds / (actualTime - start).TotalSeconds,
                    updatesSinceLastDraw, maxUpdatesSinceLastDraw, drawSkipCount);

            sb.Begin();
            sb.Draw(CatGirl, Vector2.Lerp(catGirlStart, catGirlEnd, catGirlTime), Color.White);
            sb.Draw(CatGirl, Vector2.Lerp(catGirlStart, catGirlEnd, catGirlTime+1), Color.White);
            sb.DrawString(UIFont, text, Vector2.Zero, Color.Black);
            sb.End();

            drawSkipCount += (updatesSinceLastDraw - 1);
            maxUpdatesSinceLastDraw = Math.Max(maxUpdatesSinceLastDraw, updatesSinceLastDraw);
            updatesSinceLastDraw = 0;
        }
        public void Draw(SpriteBatch spriteBatch, Microsoft.Xna.Framework.Vector2 location)
        {
            topLeftDestination.X = location.X - adjustment.X;
            topLeftDestination.Y = location.Y - adjustment.Y;

            topRightDestination.X = location.X + adjustment.X + BlockSpriteConstants.BRICKDEBRISADJUST;
            topRightDestination.Y = location.Y - adjustment.Y;

            bottomLeftDestination.X = location.X + adjustment.X;
            bottomLeftDestination.Y = location.Y - adjustment.Y + BlockSpriteConstants.BRICKDEBRISADJUST;

            bottomRightDestination.X = location.X - adjustment.X + BlockSpriteConstants.BRICKDEBRISADJUST;
            bottomRightDestination.Y = location.Y - adjustment.Y + BlockSpriteConstants.BRICKDEBRISADJUST;

            if (timer < BlockSpriteConstants.BRICKDEBRISTIMER)
            {
                spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenScaler.ScalingMatrix);
                spriteBatch.Draw(spriteSheet, topLeftDestination, sourceRectangle, Color.White);
                spriteBatch.Draw(spriteSheet, topRightDestination, sourceRectangle, Color.White);
                spriteBatch.Draw(spriteSheet, bottomLeftDestination, sourceRectangle, Color.White);
                spriteBatch.Draw(spriteSheet, bottomRightDestination, sourceRectangle, Color.White);
                spriteBatch.End();
            }
            
        }
예제 #32
0
파일: howto.cs 프로젝트: mrpossoms/AnimoNex
        public static void draw(SpriteBatch sb,Texture2D tex1)
        {
            sb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
            //shaders.MainMenuBlurBegin();
            sb.Draw(tex1, Vector2.Zero, Color.White);
            //shaders.MainMenuBlurEnd();
            sb.End();

            sb.Begin();
            if (timeWaited < 3)
            {
                if (timeWaited > 0.5f)
                {
                    if (Controller.is_a_pressed(PlayerIndex.One))
                        timeWaited = 3;
                }

                sb.Draw(howtoTex, Vector2.Zero, Color.White);
            }
            else
            {
                if (Controller.is_a_pressed(PlayerIndex.One))
                    timeWaited = 5;
                sb.Draw(controls, Vector2.Zero, Color.White);
            }
            timeWaited += 0.005f;
            if (timeWaited > 5)
            {
                Game1.currentMenu = Game1.activeMenu.main;
                timeWaited = 0;
            }

            sb.End();
        }
예제 #33
0
        public static void Draw(GameTime gameTime, Texture2D texture, SpriteBatch batch)
        {
            // DRAW SCORE
            var rectGear = new Rectangle(448, 640, 64, 64);
            batch.Draw(texture, new Vector2(0, 0), rectGear, Color.Goldenrod);
            var score = String.Format("x{0}", Game1.player.GearCount);
            batch.DrawString(Game1.font, score, new Vector2(64, 0), Color.Black);

            int i = 0;

            batch.DrawString(Game1.font, "               GAME OVER  ",   new Vector2(100, 50 * i++), Color.Black);
            batch.DrawString(Game1.font, "Students:       Ben Branch", new Vector2(100, 50 * i++), Color.White);
            batch.DrawString(Game1.font, "            Addison Denchik", new Vector2(100, 50 * i++), Color.White);
            batch.DrawString(Game1.font, "             Joshua Gold", new Vector2(100, 50 * i++), Color.White);
            batch.DrawString(Game1.font, "              Aaron Kimbrell", new Vector2(100, 50 * i++), Color.White);
            batch.DrawString(Game1.font, "              Micki Salkin", new Vector2(100, 50 * i++), Color.White);
            batch.DrawString(Game1.font, "Counselors:  Laynie Boland", new Vector2(100, 50 * i++), Color.White);
            batch.DrawString(Game1.font, "              Derek Garde", new Vector2(100, 50 * i++), Color.White);
            batch.DrawString(Game1.font, "Instructor:  Joseph Hall", new Vector2(100, 50 * i++), Color.White);

            Vector2 origin = new Vector2(64, 0);
            float rotate = MathHelper.ToRadians(-90);
            Vector2 locDeadGuy = new Vector2(250,0);
            Rectangle rectStanding = new Rectangle(128, 512, 64, 128);
            batch.Draw(texture, locDeadGuy, rectStanding, Color.White, rotate, origin, 1, SpriteEffects.None, 0);
        }
예제 #34
0
        public void Draw(ISet<State> states, SpriteBatch spriteBatch, XnaRectangle position, XnaColor color)
        {
            int rowTopHeight = _centerTop.Height;
            int rowBottomHeight = _centerBottom.Height;
            int rowCenterHeight = position.Height - rowTopHeight - rowBottomHeight;

            int startY = position.Top;
            int rowCenterTop = startY + rowTopHeight;
            int rowBottomTop = startY + position.Height - rowBottomHeight;

            int colLeftWidth = _leftCenter.Width;
            int colRightWidth = _rightCenter.Width;
            int colCenterWidth = position.Width - colLeftWidth - colRightWidth;

            int startX = position.Left;
            int colCenterLeft = startX + colLeftWidth;
            int colRightLeft = startX + position.Width - colRightWidth;

            spriteBatch.Draw(_texture, new XnaRectangle(startX, startY, colLeftWidth, rowTopHeight), _leftTop, color);
            spriteBatch.Draw(_texture, new XnaRectangle(startX, rowCenterTop, colLeftWidth, rowCenterHeight), _leftCenter, color);
            spriteBatch.Draw(_texture, new XnaRectangle(startX, rowBottomTop, colLeftWidth, rowBottomHeight), _leftBottom, color);
            spriteBatch.Draw(_texture, new XnaRectangle(colCenterLeft, startY, colCenterWidth, rowTopHeight), _centerTop, color);
            spriteBatch.Draw(_texture, new XnaRectangle(colCenterLeft, rowCenterTop, colCenterWidth, rowCenterHeight), _center, color);
            spriteBatch.Draw(_texture, new XnaRectangle(colCenterLeft, rowBottomTop, colCenterWidth, rowBottomHeight), _centerBottom, color);
            spriteBatch.Draw(_texture, new XnaRectangle(colRightLeft, startY, colRightWidth, rowTopHeight), _rightTop, color);
            spriteBatch.Draw(_texture, new XnaRectangle(colRightLeft, rowCenterTop, colRightWidth, rowCenterHeight), _rightCenter, color);
            spriteBatch.Draw(_texture, new XnaRectangle(colRightLeft, rowBottomTop, colRightWidth, rowBottomHeight), _rightBottom, color);
        }
예제 #35
0
 public void Draw(SpriteBatch theSpriteBatch)
 {
     theSpriteBatch.Draw(background, this.Position + new Vector2((period) * background.Width, 0), new Rectangle(0, 0, background.Width, background.Height), this.Color, this.Rotation, Vector2.Zero, 1.0f, SpriteEffects.None, 0);
     theSpriteBatch.Draw(background, this.Position + new Vector2((period + 1) * background.Width, 0), new Rectangle(0, 0, background.Width, background.Height), this.Color, this.Rotation, Vector2.Zero, 1.0f, SpriteEffects.None, 0);
     theSpriteBatch.DrawString(font, string.Format("Level: {0}", this.period), new Vector2(702, 4), Color.Black);
     theSpriteBatch.DrawString(font, string.Format("Level: {0}", this.period), new Vector2(700, 4), Color.LightGray);
 }
예제 #36
0
        public void Draw(SpriteBatch spriteBatch, int colour)
        {
            sourceRect = new Rectangle((width * colour), 0, width, 96);

            spriteBatch.Begin();

            // Draw Left Wall
            for (int i = 0; i <= 7; i++)
            {
                destRect = new Rectangle(0, (i * 96), width, 96);
                spriteBatch.Draw(image, destRect, sourceRect, Color.White);
            }
            // Draw Right Wall
            for (int i = 0; i <= 7; i++)
            {
                destRect = new Rectangle((game.ScreenRectangle.Width - width), (i * 96), width, 96);
                spriteBatch.Draw(image, destRect, sourceRect, Color.White, 0.0f, new Vector2(0, 0), SpriteEffects.FlipHorizontally, 1.0f);
            }

            // Draw Roof
            for (int i = 0; i <= 9; i++)
            {
                destRect = new Rectangle((i * 96) + width, 0, width, 96);
                spriteBatch.Draw(image, destRect, sourceRect, Color.White, 1.5707f, new Vector2(0, 96), SpriteEffects.None, 1.0f);
            }

            spriteBatch.End();
        }
예제 #37
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);
        }
예제 #38
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();
 }
예제 #39
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);
 }
예제 #40
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);
        }
예제 #41
0
        /// <summary>
        /// Draws a texture at the specified position.
        /// </summary>
        /// <param name="pos">The position to draw the texture at.</param>
        /// <param name="texture">The texture to draw</param>
        /// <param name="scale">Amount to scale the texture by.</param>
        /// <param name="crop">The rectangle inside the texture to crop.</param>
        /// <param name="color">The color to tint the texture with.</param>
        /// <param name="rotation">The rotation to rotate the texture by.</param>
        /// <param name="rotationOrigin">The origin of the rotation inside the texture (0-1)</param>
        /// <param name="effect">The sprite effect to apply.</param>
        public void Texture(Vector2 pos, Texture2D texture, Color color = default(Color), Vector2?scale = null, Rectangle?crop = null, float rotation = 0f, Vector2?rotationOrigin = null, SpriteEffects effect = SpriteEffects.None)
        {
            if (!ItemsQueued)
            {
                ResetSpriteBatch();
            }

            Stats.DrawnTextures++;
            _monoGameSpriteBatch.Draw(texture, new Vector2((int)pos.X, (int)pos.Y) * ScaleVec, crop, color, rotation, rotationOrigin.HasValue ? rotationOrigin.Value : Vector2.Zero, (scale.HasValue ? scale.Value : Vector2.One) * ScaleVec, effect, 0f);
        }
예제 #42
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spritebatch, int xOffset)
 {
     if (isVamonos && visible)
     {
         spritebatch.Draw(vamonosTexture, Position, null, Color.White, 0f, new Vector2(vamonosTexture.Width / 2, vamonosTexture.Height), 1f, SpriteEffects.None, 0f);
     }
     else if (isAtaque && visible)
     {
         spritebatch.Draw(ataqueTexture, Position, null, Color.White, 0f, new Vector2(ataqueTexture.Width / 2, ataqueTexture.Height), 1f, SpriteEffects.None, 0f);
     }
 }
예제 #43
0
        public override void Draw(float elapsedTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            if (partsLeft > 1)
            {
                spriteBatch.Draw(spikesSpritesheet, position - spikesCenterOffset, spikesSpriteBounds, Color.White);
            }

            spriteBatch.Draw(helmetSpritesheet, position - helmetCenterOffset, helmetSpriteBounds, Color.White, 0, Vector2.Zero, 1, SpriteEffects.FlipVertically, 0);

            if (partsLeft > 2)
            {
                spriteBatch.Draw(eyeSpritesheet, position - eyeCenterOffset, eyeSpriteBounds, Color.White, eyeRotation, eyeRotationOrigin, 1, SpriteEffects.None, 0);
            }
        }
예제 #44
0
        public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            Vector2 offset;

            if (Direction == PlayerDirection.RIGHT)
            {
                offset = new Vector2(position.X + 10, position.Y);
                sb.Draw(this.Texture, offset, srcRect, Color.White, Rotation, new Vector2(Texture.Width, Texture.Height / 2), .75f, SpriteEffects.FlipVertically, 1.0f);
            }
            else
            {
                offset = new Vector2(position.X - 100, position.Y);
                sb.Draw(this.Texture, position, srcRect, Color.White, Rotation, new Vector2(Texture.Width, Texture.Height / 2), .75f, SpriteEffects.None, 1.0f);
            }
        }
예제 #45
0
파일: Life.cs 프로젝트: faudeval/projet
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Microsoft.Xna.Framework.GameTime gameTime)
 {
     if (nbVies == 3)
     {
         base.Draw(spriteBatch, gameTime);
     }
     if (nbVies == 2)
     {
         spriteBatch.Draw(heart2, Position, Color.White);
     }
     if (nbVies == 1)
     {
         spriteBatch.Draw(heart1, Position, Color.White);
     }
 }
예제 #46
0
 public override void draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
 {
     base.draw(sb);
     foreach (TouchLocation tl in Entity.tc)
     {
         if (tl.State == TouchLocationState.Moved)
         {
             if (this.sprite.Equals(GameState.loader.Load <Texture2D>("sprites\\player_idle")))
             {
                 this.swapSprites(ref sprite_prepThrowing);
             }
             sb.Draw(crosshair, tl.Position - new Vector2(20, 20), Color.White);
         }
         else if (tl.State == TouchLocationState.Released)
         {
             if (this.sprite.Equals(GameState.loader.Load <Texture2D>("sprites\\player_prepThrow")))
             {
                 this.swapSprites(ref sprite_prepThrowing);
                 this.swapSprites(ref sprite_throwStone);
                 throwTime = DateTime.Now.Ticks;
             }
         }
     }
     if (DateTime.Now.Ticks - throwTime > 2000000)
     {
         if (this.sprite.Equals(GameState.loader.Load <Texture2D>("sprites\\player_throwing")))
         {
             this.swapSprites(ref sprite_throwStone);
         }
     }
 }
예제 #47
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     if (hasButton)
     {
         Texture2D tex = Resources.Menus.ButtonSquare;
         Rectangle dim = new Rectangle(dimensions.X, dimensions.Y, tex.Width, tex.Height);
         spriteBatch.Draw(tex, dim, color);
         if (isDisplay)
         {
             DrawStandardDisplay(spriteBatch, new Point(dimensions.X + tex.Width, dimensions.Y), Text, color, ForcedLength);
         }
         else
         {
             DrawStandardButton(spriteBatch, new Point(dimensions.X + tex.Width, dimensions.Y), Text, color, ForcedLength);
         }
     }
     else
     {
         if (isDisplay)
         {
             DrawStandardDisplay(spriteBatch, new Point(dimensions.X, dimensions.Y), Text, color, ForcedLength);
         }
         else
         {
             DrawStandardButton(spriteBatch, new Point(dimensions.X, dimensions.Y), Text, color, ForcedLength);
         }
     }
 }
        public override void render(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            AnimationLib.GraphicsDevice.SetRenderTarget(textureScreen);
            AnimationLib.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Transparent, 1.0f, 0);
            renderGUI(sb2, 1.0f);
            AnimationLib.GraphicsDevice.SetRenderTarget(null);
            screenResult = (Texture2D)textureScreen;

            AnimationLib.GraphicsDevice.SetRenderTarget(halfTextureScreen);
            AnimationLib.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Transparent, 1.0f, 0);
            renderGUI(sb2, 0.5f);
            AnimationLib.GraphicsDevice.SetRenderTarget(null);
            halfSizeTexture = (Texture2D)halfTextureScreen;

            AnimationLib.GraphicsDevice.SetRenderTarget(quarterTextureScreen);
            AnimationLib.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Transparent, 1.0f, 0);
            renderGUI(sb2, 0.25f);
            AnimationLib.GraphicsDevice.SetRenderTarget(null);
            quarterSizeTexture = (Texture2D)quarterTextureScreen;

            AnimationLib.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Transparent, 1.0f, 0);

            Game1.BloomFilter.Parameters["halfResMap"].SetValue(halfSizeTexture);
            Game1.BloomFilter.Parameters["quarterResMap"].SetValue(quarterSizeTexture);
            Game1.BloomFilter.Parameters["Threshold"].SetValue(0.3f);
            Game1.BloomFilter.Parameters["BlurDistanceX"].SetValue(0.00175f);
            Game1.BloomFilter.Parameters["BlurDistanceY"].SetValue(0.00175f);

            sb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null, Game1.BloomFilter, Matrix.Identity);
            sb.Draw(screenResult, new Vector2(0), Color.White);
            sb.End();
        }
예제 #49
0
 public void DrawObject(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, SkeletonMeshRenderer meshRenderer, GameTime gameTime,
                        int mapShiftX, int mapShiftY, bool flip)
 {
     spriteBatch.Draw(texture,
                      new Rectangle(X - mapShiftX, Y - mapShiftY, texture.Width, texture.Height),
                      null, Color.White, 0f, new Vector2(0f, 0f), flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
 }
예제 #50
0
        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)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)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   = (float)(num3 - num7);
                if (num4 < 0)
                {
                    num8 = (float)(num5 - num7);
                }
                color2 *= num8 / ((float)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 * (float)(num7 - 1) * -(float)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);
        }
예제 #51
0
 public void DrawBackground(Microsoft.Xna.Framework.Graphics.SpriteBatch sprite, SkeletonMeshRenderer meshRenderer, GameTime gameTime,
                            int x, int y, Color color, bool flip, ReflectionDrawableBoundary drawReflectionInfo)
 {
     sprite.Draw(texture, new
                 Rectangle(x, y, texture.Width, texture.Height),
                 null, color, 0f, new Vector2(0f, 0f), flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
 }
예제 #52
0
        public void Draw(Microsoft.Xna.Framework.GameTime gameTime, ref Microsoft.Xna.Framework.Graphics.SpriteBatch sp, ref Microsoft.Xna.Framework.GraphicsDeviceManager g, ref Microsoft.Xna.Framework.Graphics.SpriteFont font)
        {
            sp.Begin();

            /// Logic for drawing the ActiveBackground
            ActiveBackground.DrawSky();
            ActiveBackground.DrawSunrays();
            ActiveBackground.DrawFlowers();
            ActiveBackground.DrawGrass();
            ActiveBackground.DrawSun();
            ActiveBackground.DrawCloud1();
            ActiveBackground.DrawCloud2();
            ActiveBackground.DrawCloud3();
            ActiveBackground.DrawCloud4();
            ActiveBackground.DrawCloud5();

            // Draws the Background-Image
            // sp.Draw(background, new Rectangle(0, 0, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height), Color.White);

            // Draws the player-picture in question to detailview
            // sp.Draw(player_picture, detailPictureOutlines, Color.White);

            sp.Draw(player_picture, new Rectangle((int)(bZero * 0.300), (int)(hZero * 0.200), (int)(bZero * 0.400), (int)(hZero * 0.600)), Color.White);

            // Draws the caption in the Topleft-Corner
            // sp.DrawString(font, "Detailview - Click anywhere to return", new Vector2(20, 20), Color.Black);

            // Draws the caption that tells the player how to return to the highscore-tablescreen
            sp.DrawString(font, "Click on the Background to return", new Vector2((int)(bZero * 0.300), 40), Color.White);
            sp.End();
        }
        public void DrawLine(SpriteBatch sprite, Vector2 start, Vector2 end, Color color)
        {
            int   width    = (int)Vector2.Distance(start, end);
            float rotation = (float)Math.Atan2((double)(end.Y - start.Y), (double)(end.X - start.X));

            sprite.Draw(pixel, new Rectangle((int)start.X, (int)start.Y, width, UserSettings.LineWidth), null, color, rotation, new Vector2(0f, 0f), SpriteEffects.None, 1f);
        }
예제 #54
0
        protected override void OnDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb, ref Point offect)
        {
            if (color.A == 0)
            {
                return;
            }
            float     width  = seedsize.X * this.scenescale.X;
            float     height = seedsize.Y * this.scenescale.Y;
            float     x      = this.scenepos.X;
            float     y      = this.scenepos.Y;
            Rectangle dest   = new Rectangle((int)x, (int)y, (int)width, (int)height);

            Rectangle src = new Rectangle((int)(block.uv.X * block.parent.texture.Width),
                                          (int)(block.uv.Y * block.parent.texture.Height),
                                          (int)(block.uv.Width * block.parent.texture.Width),
                                          (int)(block.uv.Height * block.parent.texture.Height));
            Vector2 orient = seedorient;

            orient.X *= src.Width / seedsize.X;
            orient.Y *= src.Height / seedsize.Y;

#if XNA
#else
            //monogame orient 实现有bug...
            //orient.X *= (float)block.parent.texture.Width /src.Width;
            //orient.Y *=  (float)block.parent.texture.Height/src.Height;
#endif
            //float rotate = rotate * Math.Sign(scenescale.X) * Math.Sign(scenescale.Y);
            sb.Draw(block.parent.texture, dest, src, color, rotate, orient, SpriteEffects.None, 0);
            //sb.Draw(d.block.parent.texture, new Rectangle((int)(pos.X - 2), (int)(pos.Y - 2), 4, 4), Color.Red);
        }
예제 #55
0
        public void Draw(Microsoft.Xna.Framework.GameTime gameTime, ref Microsoft.Xna.Framework.Graphics.SpriteBatch sp, ref Microsoft.Xna.Framework.GraphicsDeviceManager graphics, ref Microsoft.Xna.Framework.Graphics.SpriteFont font)
        {
            sp.Begin();

            g.Clear(Color.Black);

            /// Logic for drawing the ActiveBackground
            ActiveBackground.DrawSky();
            ActiveBackground.DrawSunrays();
            ActiveBackground.DrawFlowers();
            ActiveBackground.DrawGrass();
            ActiveBackground.DrawSun();
            ActiveBackground.DrawCloud1();
            ActiveBackground.DrawCloud2();
            ActiveBackground.DrawCloud3();
            ActiveBackground.DrawCloud4();
            ActiveBackground.DrawCloud5();

            // Draws the Background-Image
            // sp.Draw(background, new Rectangle(0, 0, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height), Color.White);

            // sp.DrawString(font, "Options", new Vector2(20, 20), Color.White);

            foreach (Button btn in bl)
            {
                sp.Draw(btn.Texture, btn.Position, btn.SourceRectangle, btn.Color, btn.Rotation, btn.Origin, btn.Scale, btn.Effect, btn.LayerDepth);
            }

            sp.End();
        }
예제 #56
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            if (texture == null)
            {
                return;
            }

            int column;
            int row;

            if (_fixed)
            {
                column = fixedAtColumn;
                row    = fixedAtRow;
            }
            else
            {
                column = currentColumn;
                row    = currentRow;
            }


            Rectangle rect1 =
                new Rectangle((int)getPos().X, (int)getPos().Y, dimensions.Width, dimensions.Height);

            rect1.X -= (int)TheGame.Instance.map.Pos.X;
            Rectangle rect2 =
                new Rectangle(column * (int)this.sourceDimensions.X, row * (int)this.sourceDimensions.Y, dimensions.Width, dimensions.Height);

            spriteBatch.Draw(texture, rect1, rect2,
                             Color.White);
        }
예제 #57
0
 public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch drawer)
 {
     if (overlay != null)
     {
         drawer.Draw(overlay, drawer.GraphicsDevice.Viewport.Bounds, tint);
     }
 }
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     if (Type != BulletEmitterType.Invisible)
     {
         spriteBatch.Draw(Texture, Center, Texture.Bounds, Color.White, Rotation, Origin, 1f, SpriteEffects.None, 0f);
     }
 }
 public override void  draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     Game1.self.GraphicsDevice.Clear(Color.White);
     spriteBatch.Begin();
     spriteBatch.Draw(texture, Vector2.Zero, Color.White);
     spriteBatch.End();
 }
 public override void  draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     Game1.self.GraphicsDevice.Clear(backgroundColor);
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone);
     spriteBatch.Draw(texture, Game1.self.GraphicsDevice.Viewport.Bounds, backgroundColor);
     spriteBatch.End();
 }