public override void Draw(Context context)
        {
            int x = 100;
            int y = 100;

            DrawAnim(context, groupInstance, x, y);
        }
        public override void Draw(Context context)
        {
            PreDraw(context);

            DrawGrid(context);
            DrawCells(context);
            DrawSpecial(context);

            PostDraw(context);
        }
        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);
        }
        public override void Draw(Context context)
        {
            PreDraw(context);

            float dx;
            float dy = 0;
            int itemHeight = m_font.FontHeight();

            if (m_hasBackColor)
            {
                context.FillRect(0, 0, width, height, m_backColor);
            }

            for (int i = 0; i < formattedStrings.Length; i++)
            {
                FormattedString str = formattedStrings[i];
                dx = alignX * (width - str.width);
                m_font.DrawString(context, str.text, dx, dy);
                dy += itemHeight + m_font.LineOffset();
            }

            PostDraw(context);
        }
 private void DrawSolid(Context context, FieldCell cell)
 {
     DrawCellImage(context, cell, solidImage);
 }
Пример #6
0
        protected void RestoreTransformations(Context context)
        {
            if (color != Color.White)
            {
                context.SetColor(Color.White);
            }

            // if any transformation
            if (rotation != 0.0 || scaleX != 1.0 || scaleY != 1.0 || translateX != 0.0 || translateY != 0.0)
            {
                context.PopMatrix();
            }
        }
Пример #7
0
 protected virtual void PostDraw(Context context)
 {
     DrawChildren(context);
     DrawBorders(context);
     RestoreTransformations(context);
 }
Пример #8
0
 public override void Draw(Context context)
 {
     PreDraw(context);
     PostDraw(context);
 }
 public void Draw(Context context, float x, float y, Color color)
 {
     m_animation.Draw(context, m_frameIndex, x, y, color);
 }
        private void DrawPrompt(Context context)
        {
            float drawX = 10;
            float drawY = height - lineHeight - lineSpacing - 10;

            font.DrawString(context, PROMPT_STRING, drawX, drawY);
            drawX += PROMPT_STRING.Length * charWidth;

            if (carretVisible)
            {
                context.FillRect(drawX + cursorPos * charWidth, drawY + lineHeight, charWidth, 3, Color.White);
            }

            font.DrawString(context, commandBuffer.ToString(), drawX, drawY);
        }
 public virtual void Draw(Context context)
 {
 }
 public override void Draw(Context context)
 {
     screenManager.Draw(context);
 }
        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);
                }
            }
        }
        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);
            }
        }
 private void DrawSpecial(Context context)
 {
     List<Player> players = field.GetPlayers().list;
     foreach (Player player in players)
     {
         DrawSpecial(context, player);
     }
 }
        public override void Draw(Context context)
        {
            context.FillRect(0, 0, width, height, backColor);

            DrawLines(context);
            DrawPrompt(context);
        }
        private void DrawLines(Context context)
        {
            float drawX = 10;
            float drawY = height - 2 * (lineHeight + lineSpacing) - 10;

            for (LinkedListNode<String> node = output.lastNode; node != null; node = node.Previous)
            {
                String line = node.Value;

                font.DrawString(context, line, drawX, drawY);
                drawY -= lineHeight + lineSpacing;

                if (drawY < 0)
                {
                    break;
                }
            }
        }
 public override void Draw(Context context)
 {
     base.Draw(context);
 }
        private void DrawAnim(Context context, AnimationInstance instance, int x, int y)
        {
            int frameIndex = instance.FrameIndex;
            TextureImage texture = instance.Texture;

            Animation group = instance.Animation;

            Rectangle src;
            int ox = group.frames[frameIndex].ox;
            int oy = group.frames[frameIndex].oy;

            src.X = group.frames[frameIndex].x;
            src.Y = group.frames[frameIndex].y;
            src.Width = group.frames[frameIndex].w;
            src.Height = group.frames[frameIndex].h;

            context.DrawImagePart(texture, src, x - ox, y - oy);
        }
 public override void Draw(Context context)
 {
     drawables.Draw(context);
 }
 public override void Draw(Context context)
 {
     PreDraw(context);
     context.DrawImage(texture, 0, 0);
     PostDraw(context);
 }
Пример #22
0
 public override void Draw(Context context)
 {
     mRootView.Draw(context);
     drawables.Draw(context);
 }
 public void Draw(Context context, float x, float y)
 {
     Draw(context, x, y, Color.White);
 }
 private void DrawConsole(Context context)
 {
     if (m_console.IsVisible)
     {
         m_console.Draw(context);
     }
 }
Пример #25
0
 protected virtual void DrawChildren(Context context)
 {
     viewList.Draw(context);
 }
 private void DrawDebugView(Context context)
 {
     m_debugView.Draw(context);
 }
Пример #27
0
        protected virtual void PreDraw(Context context)
        {
            // align to parent
            translateX = x - width * alignX;
            translateY = y - height * alignY;

            if (parent != null)
            {
                translateX += parent.width * parentAlignX;
                translateY += parent.height * parentAlignY;
            }

            bool changeScale = (scaleX != 1.0 || scaleY != 1.0);
            bool changeRotation = (rotation != 0.0);
            bool changeTranslate = (translateX != 0.0 || translateY != 0.0);

            // apply transformations
            if (changeTranslate || changeRotation || changeScale)
            {
                context.PushMatrix();

                if (changeRotation || changeScale)
                {
                    float rotationOffsetX = translateX + (0.5f * width) + rotationCenterX;
                    float rotationOffsetY = translateY + (0.5f * height) + rotationCenterY;

                    context.Translate(rotationOffsetX, rotationOffsetY);

                    if (changeRotation)
                    {
                        context.Rotate(rotation, 0, 0, 1);
                    }

                    if (changeScale)
                    {
                        context.Scale(scaleX, scaleY, 1);
                    }
                    context.Translate(-rotationOffsetX, -rotationOffsetY);
                }

                if (changeTranslate)
                {
                    context.Translate(translateX, translateY);
                }
            }

            if (color != Color.White)
            {
                context.SetColor(color);
            }
        }
        //////////////////////////////////////////////////////////////////////////////

        #region Drawable

        public override void Draw(Context context)
        {
            m_currentController.Draw(context);
            DrawDebugView(context);
            DrawConsole(context);
        }
Пример #29
0
 private void DrawBorders(Context context)
 {
     if (CVars.g_drawViewBorders.boolValue)
     {
         context.DrawRect(0, 0, width, height, Color.White);
     }
 }
        private void DrawPowerup(Context context, PowerupCell powerupCell)
        {
            int powerup = powerupCell.powerup;
            if (powerup != Powerups.None)
            {
                if (powerup == Powerups.Random)
                {
                    powerup = ((int)(powerupCell.elasped / 0.05f)) % powerupImages.Length;
                }

                TextureImage image = powerupImages[powerup];
                DrawCellImage(context, powerupCell, image);
            }
        }