Exemple #1
0
        public void DrawScaledImage(TextureImage tex, float x, float y, float scaleX, float scaleY)
        {
            Vector2 origin = new Vector2(0.5f * tex.GetWidth(), 0.5f * tex.GetHeight());
            Vector2 scale  = new Vector2(scaleX, scaleY);

            GetSpriteBatch(BatchMode.Sprite).Draw(tex.GetTexture(), new Vector2(x, y), null, drawColor, 0.0f, origin, scale, SpriteEffects.None, 0.0f);
        }
Exemple #2
0
        private void DrawCellImage(Context context, FieldCell cell, TextureImage image)
        {
            float drawX = cell.GetPx() - 0.5f * image.GetWidth();
            float drawY = cell.GetPy() - 0.5f * image.GetHeight();

            context.DrawImage(image, drawX, drawY);
        }
        public PowerupView(TextureImage tex, int count)
            : base(tex.GetWidth(), tex.GetHeight())
        {
            ImageView view = new ImageView(tex);

            AddView(view);

            m_countTextView           = new TextView(Helper.fontSystem, "");
            m_countTextView.backColor = Color.Black;
            AddView(m_countTextView);

            m_dimmingView = new RectView(0, 0, width, height, new Color(0, 0, 0, 0.5f), Color.Black);
            AddView(m_dimmingView);

            SetCount(count);
        }
Exemple #4
0
        private void DrawBrick(Context context, BrickCell cell)
        {
            DrawCellImage(context, cell, breakableImage);

            if (CVars.g_drawHiddenPowerups.boolValue)
            {
                int powerup = cell.powerup;
                if (powerup != Powerups.None)
                {
                    TextureImage powerupImage = powerupImages[powerup];
                    float        drawX        = cell.GetPx() - 0.5f * powerupImage.GetWidth();
                    float        drawY        = cell.GetPy() - 0.5f * powerupImage.GetHeight();
                    context.DrawImage(powerupImage, drawX, drawY, 0.25f);
                }
            }
        }
Exemple #5
0
        private void DrawBomb(Context context, Bomb bomb)
        {
            float drawX = bomb.GetPx();
            float drawY = bomb.GetPy();

            AnimationInstance anim = bomb.currentAnimation;

            anim.Draw(context, drawX, drawY + 0.5f * cellHeight, bomb.IsBlocked ? Color.Red : Color.White);

            if (CVars.g_drawBombDir.boolValue)
            {
                TextureImage dirImage = dirLookup[bomb.direction];
                context.DrawImage(dirImage, drawX - 0.5f * dirImage.GetWidth(), drawY - 0.5f * dirImage.GetHeight());
            }

            context.DrawRect(bomb.cx * cellWidth, bomb.cy * cellHeight, cellWidth, cellHeight, Color.White);
            context.DrawRect(bomb.px - 0.5f * cellWidth, bomb.py - 0.5f * cellHeight, cellWidth, cellHeight, Color.Red);
        }
Exemple #6
0
        private void DrawSpecial(Context context, Player player)
        {
            Bomb bomb = player.bombInHands;

            if (bomb != null)
            {
                TextureImage image = Helper.GetTexture(A.gfx_bmb1001);

                float drawX = player.GetPx() - 0.5f * image.GetWidth();
                float drawY = player.GetPy() - 1.5f * image.GetHeight();
                context.DrawImage(image, drawX, drawY);
            }

            List <Bomb> thrownBombs = player.thrownBombs;

            foreach (Bomb b in thrownBombs)
            {
                TextureImage image = Helper.GetTexture(A.gfx_bmb1001);

                float drawX = b.GetPx() - 0.5f * image.GetWidth();
                float drawY = b.GetPy() - 0.5f * image.GetHeight() - b.fallHeight;
                context.DrawImage(image, drawX, drawY);
            }
        }
Exemple #7
0
 public ImageView(TextureImage texture)
     : base(texture.GetWidth(), texture.GetHeight())
 {
     this.texture = texture;
 }