/// <summary> /// Initializes a new instance of the <see cref="SnakeGameWindow"/> class. /// </summary> public SnakeGameWindow(SnakeGameGUI snakeGameGUI) { this.snakeGameGUI = snakeGameGUI; gridWidth = snakeGameGUI.GridGUI.GridWidth; gridHeight = snakeGameGUI.GridGUI.GridHeight; sideLength = snakeGameGUI.GridGUI.SideLength; SetUpBitMap(); SetUpLabels(); SetUpButtons(); AddControls(); // Enables double buffering to smooth the rendering. EnableDoubleBuffering(); // Timer to control the framerate. Timer = new Timer(); Timer.Interval = 1; SetUpEventArguments(); SetUpWindowSettings(); // Start the timer, which starts the game. Timer.Start(); }
/// <summary> /// Runs a GUI window of the snake game. /// </summary> public void StartGUI() { withGUI = true; snakeGameGUI = new SnakeGameGUI(snakeSettings, this); snakeGameGUI.OpenGameWindow(); }