Ejemplo n.º 1
0
        //Updates
        public void buttonclick()
        {
            prevState = mouse;
            mouse     = Mouse.GetState();
            int x = mouse.X, y = mouse.Y;

            if (!but2Select)
            {
                if (but1.state(x, y, mouse, prevState))
                {
                    but1Select = true;
                    but2Select = false;
                    player     = 0;
                }
            }
            if (!but1Select)
            {
                if (but2.state(x, y, mouse, prevState))
                {
                    but1Select = false;
                    but2Select = true;
                    player     = 0;
                }
            }
            if (butReset.state(x, y, mouse, prevState) &&
                (but1Select || but2Select))
            {
                but1Select = but2Select = endGame = draw = xWins = oWins = compStarts = userStarts = easy = hard = false;
                empty      = true;
                table.reset();
                player = 1;
                Console.WriteLine("Reset");
            }
            if (butComp.state(x, y, mouse, prevState) &&
                but1Select && !userStarts)
            {
                compStarts = true;
                userStarts = false;
                player     = 0;
                Console.WriteLine("Computer Starts");
            }
            if (butUser.state(x, y, mouse, prevState) &&
                but1Select && !compStarts)
            {
                userStarts = true;
                compStarts = false;
                player     = 1;
                Console.WriteLine("User starts");
            }
            if (butEasy.state(x, y, mouse, prevState) &&
                !hard)
            {
                easy = true;
                hard = false;
                Console.WriteLine("Easy");
            }
            if (butHard.state(x, y, mouse, prevState) &&
                !easy)
            {
                easy = false;
                hard = true;
                Console.WriteLine("Hard");
            }
        }