49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
namespace TicTacToe
|
|
{
|
|
public static class Program
|
|
{
|
|
public static Form1 form = new Form1();
|
|
static Game game = new Game();
|
|
static int wins = 0;
|
|
static int loses = 0;
|
|
|
|
static void Main()
|
|
{
|
|
ApplicationConfiguration.Initialize();
|
|
game.Start();
|
|
form.newGameToolStripMenuItem.Click += NewGame;
|
|
form.exitToolStripMenuItem.Click += Exit;
|
|
form.aboutToolStripMenuItem.Click += About;
|
|
Application.Run(form);
|
|
}
|
|
|
|
static void NewGame(object? sender, EventArgs e)
|
|
{
|
|
game.Destroy();
|
|
game = new Game();
|
|
game.Start();
|
|
}
|
|
|
|
static void About(object? sender, EventArgs e)
|
|
{
|
|
MessageBox.Show("Tic Tac Toe med motståndare, kodat av Max Westerlund");
|
|
}
|
|
|
|
static void Exit(object? sender, EventArgs e)
|
|
{
|
|
Application.Exit();
|
|
}
|
|
|
|
public static void AddLose()
|
|
{
|
|
loses += 1;
|
|
form.lbl_loses.Text = "Antal Förluster: " + loses.ToString();
|
|
}
|
|
|
|
public static void AddWin()
|
|
{
|
|
wins += 1;
|
|
form.lbl_wins.Text = "Antal Vinster: " + wins.ToString();
|
|
}
|
|
}
|
|
} |