예제 #1
0
        public Form1()
        {
            InitializeComponent();

            // Größe auf die Client-Größe setzen
            logic = new SnakeLogic(this.ClientSize);
            logic.OnDesirePaint += (s, e) => {
                snakePanel.Invalidate();
            };

            snakePanel = new SnakePanel(logic)
            {
                // Panel ist so groß wie die Client-Größe (dockt an)
                Dock = DockStyle.Fill
            };

            Controls.Add(snakePanel);
        }
예제 #2
0
 public void AddSnakePanel()
 {
     Point p = new Point(snakePanels[snakePanels.Count - 1].Me.Location.X - 40, snakePanels[snakePanels.Count - 1].Me.Location.Y - 40);
     SnakePanel panel = new SnakePanel(gameField, p, snakePanelSize);
     snakePanels.Add(panel);
 }