コード例 #1
0
ファイル: GameLogic.cs プロジェクト: Needix/Game_Chess
        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);
        }
コード例 #2
0
ファイル: GamePanel.cs プロジェクト: Needix/Game_Chess
        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;
        }