Exemple #1
0
 public void Draw()
 {
     using (var g = Graphics.FromImage(buffer))
     {
         Rectangle main = new Rectangle(0, 0, Proportion.ClientSize(100), Proportion.windowWidth);
         g.FillRectangle(Brushes.WhiteSmoke, main);
     }
 }
Exemple #2
0
 public void Draw()
 {
     using (var g = Graphics.FromImage(buffer))
     {
         int x    = Proportion.ClientSize(position.x) - Proportion.ClientSize(Config.ENEMYSIZE / 2);
         int y    = Proportion.ClientSize(position.y) - Proportion.ClientSize(Config.ENEMYSIZE / 2);
         int size = Proportion.ClientSize(Config.ENEMYSIZE);
         g.FillRectangle(new SolidBrush(enemyColor), x, y, size, size);
     }
 }
 public void Draw()
 {
     using (var g = Graphics.FromImage(buffer))
     {
         int cornerCord = Proportion.ClientSize(Config.CORNERSIZE + Config.INNERSQUARESIZE);
         int cornerSize = Proportion.ClientSize(Config.CORNERSIZE);
         g.FillRectangle(Brushes.Black, new Rectangle(0, 0, cornerSize, cornerSize));
         g.FillRectangle(Brushes.Black, new Rectangle(0, cornerCord, cornerSize, cornerSize));
         g.FillRectangle(Brushes.Black, new Rectangle(cornerCord, 0, cornerSize, cornerSize));
         g.FillRectangle(Brushes.Black, new Rectangle(cornerCord, cornerCord, cornerSize, cornerSize));
     }
 }
Exemple #4
0
 public void Draw()
 {
     using (var g = Graphics.FromImage(buffer))
     {
         int       cornerSize   = Proportion.ClientSize(Config.CORNERSIZE);
         int       innerSize    = Proportion.ClientSize(Config.INNERSQUARESIZE);
         Rectangle middleSquare = new Rectangle(cornerSize, cornerSize, innerSize, innerSize);
         g.FillRectangle(Brushes.Gray, middleSquare);
         Pen borderPen = new Pen(Color.FromArgb(105, 105, 105), 4)
         {
             Alignment = System.Drawing.Drawing2D.PenAlignment.Inset
         };
         g.DrawRectangle(borderPen, middleSquare);
     }
 }
Exemple #5
0
        public void Draw()
        {
            using (var g = Graphics.FromImage(buffer))
            {
                string font = "Comic Sans MS";

                int       mainSquareY      = Proportion.ClientSize(Config.CORNERSIZE) / 2;
                int       mainSquareHeight = Proportion.ClientSize(Config.INNERSQUARESIZE) + Proportion.ClientSize(Config.CORNERSIZE);
                Rectangle mainScoreSquare  = new Rectangle(0, mainSquareY, Proportion.windowWidth, mainSquareHeight);
                g.FillRectangle(new SolidBrush(Color.FromArgb(230, Color.Black)), mainScoreSquare);

                int   h1FontSize = Proportion.windowWidth / 25;
                float titleX     = (float)(Proportion.windowWidth / 2 - 75);
                float titleY     = (float)(Proportion.ClientSize(Config.CORNERSIZE) / 1.5);
                g.DrawString("High Scores", new Font(font, h1FontSize), Brushes.White, titleX, titleY);

                int   pFontSize = Proportion.windowWidth / 40;
                float tHeadX1   = 20;
                float tHeadY1   = (float)Proportion.ClientSize(Config.CORNERSIZE);
                g.DrawString("Player", new Font(font, pFontSize), Brushes.White, tHeadX1, tHeadY1);

                float tHeadX2 = (float)(Proportion.windowWidth - 60);
                float tHeadY2 = (float)Proportion.ClientSize(Config.CORNERSIZE);
                g.DrawString("Score", new Font(font, pFontSize), Brushes.White, tHeadX2, tHeadY2);

                int index          = 0;
                int positionReduce = 20;
                lock (scoreTableLock)
                {
                    foreach (GamePlayer player in players.getPlayers())
                    {
                        float  playerNameX = 20;
                        float  playerNameY = (float)(Proportion.ClientSize(Config.CORNERSIZE) + positionReduce);
                        string playerName  = "Player" + index;
                        string playerScore = player.score.ToString();
                        g.DrawString(playerName, new Font(font, pFontSize), Brushes.White, playerNameX, playerNameY);

                        float playerScoreX = (float)(Proportion.windowWidth - 60);
                        float playerScoreY = (float)(Proportion.ClientSize(Config.CORNERSIZE) + positionReduce);
                        g.DrawString(playerScore, new Font(font, pFontSize), Brushes.White, playerScoreX, playerScoreY);

                        index++;
                        positionReduce += positionReduce;
                    }
                }
            }
        }