示例#1
0
 public void Draw(SpriteBatch sb_)
 {
     foreach (Vector2 p in pos)
     {
         particle.Draw(sb_, p);
     }
 }
示例#2
0
 public void Draw(SpriteBatch sb, int hp)
 {
     tex.c_sourceRect = new Rectangle(0, 0, 16 * hp, 16);
     tex.Draw(sb, Vector2.Zero);
 }
示例#3
0
 public virtual void Draw(SpriteBatch sb_)
 {
     SelectTexWow();
     currentTex.Draw(sb_, pos, facesLeft);
 }
示例#4
0
文件: Game1.cs 项目: Fusionnist/LD40
        //DRAW
        protected override void Draw(GameTime gameTime)
        {
            //TEXT DRAW
            Matrix scaler = Matrix.CreateScale(2f / zoom);

            GraphicsDevice.SetRenderTarget(textTarget);
            GraphicsDevice.Clear(Color.TransparentBlack);
            spriteBatch.Begin();

            spriteBatch.End();

            //OVERLAY DRAW
            GraphicsDevice.SetRenderTarget(overlayTarget);
            GraphicsDevice.Clear(Color.TransparentBlack);
            spriteBatch.Begin(transformMatrix: scaler, samplerState: SamplerState.PointWrap, sortMode: SpriteSortMode.Immediate);

            if (gp == GamePhase.Menu)
            {
                DrawMenuElements();
            }
            else if (gp == GamePhase.End)
            {
                DrawEndElements();
            }
            else
            {
                fd.DrawText("font", currentStr, new Rectangle(0, 272 + (int)(zoom - 1) * 320, 640, 320), spriteBatch);
                fd.DrawText("font", "wealth:" + wealth, new Rectangle(464, 16, 160, 320), spriteBatch);
                //fd.DrawText("font", player.isOnLadder.ToString(), new Rectangle(0, 272, 640, 320), spriteBatch);
                for (int x = 0; x < 5; x++)
                {
                    if (x < player.hp)
                    {
                        fullheart.Draw(spriteBatch, new Vector2(16 + 16 * x, 16));
                    }
                    if (x >= player.hp)
                    {
                        emptyheart.Draw(spriteBatch, new Vector2(16 + 16 * x, 16));
                    }
                }
                if (player.isDead)
                {
                    fd.DrawText("font", "oh no! you got caught! press r to restart!", new Rectangle(64, 64, 512, 192), spriteBatch);
                }
            }
            spriteBatch.End();

            //GAME DRAW
            Matrix translation = Matrix.CreateTranslation(new Vector3(-mapPos.X * 640, -mapPos.Y * 320, 0)) * scaler;

            GraphicsDevice.SetRenderTarget(gameTarget);
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin(transformMatrix: translation, samplerState: SamplerState.PointWrap, sortMode: SpriteSortMode.Immediate);
            if (gp == GamePhase.Game)
            {
                DrawGameElements();
            }
            spriteBatch.End();

            //DEFINITIVE DRAW
            GraphicsDevice.SetRenderTarget(null);
            spriteBatch.Begin(samplerState: SamplerState.PointWrap, sortMode: SpriteSortMode.Immediate);
            Rectangle dest = new Rectangle(targetPos.X, targetPos.Y, (int)(virtualDims.X * scale), (int)(virtualDims.Y * scale));

            spriteBatch.Draw(gameTarget, destinationRectangle: dest);
            spriteBatch.Draw(textTarget, destinationRectangle: dest);
            spriteBatch.Draw(overlayTarget, destinationRectangle: dest);
            spriteBatch.End();
            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }
示例#5
0
文件: Game1.cs 项目: Fusionnist/LD40
 void DrawEndElements()
 {
     endscr.Draw(spriteBatch, Vector2.Zero);
 }
示例#6
0
文件: Game1.cs 项目: Fusionnist/LD40
 void DrawMenuElements()
 {
     menu.Draw(spriteBatch, Vector2.Zero);
 }