Beispiel #1
0
        public GameLogic(GamePanel panel)
        {
            _panel = panel;
            _instance = this;

            GridFigures = new List<BaseFigure>();
            DestroyedFigures = new List<BaseFigure>();

            InitGameGrid();

            Player = new Player[2];
            Player[0] = new Player("Player1", Logic.Player.Teams.TeamWhite);
            Player[1] = new Player("Player2", Logic.Player.Teams.TeamBlack);
        }
Beispiel #2
0
        public GamePanel()
        {
            SetStyle(ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true);

            _logic = new GameLogic(this);

            _redrawThread = new Thread(RedrawThread);
            _redrawThread.Name = "RedrawThread";
            _redrawThread.Start();

            xPerField = Width / GameLogic.GRID_SIZE;
            yPerField = Height / GameLogic.GRID_SIZE;

            DrawChess = true;

            this.MouseClick += _logic.MouseClick;
        }