Beispiel #1
0
        public void GameCallbackExitTest()
        {
            Game game = new Game(10, 10);

            Assert.IsTrue(game.ControllCallback(ConsoleKey.Escape));
            Assert.IsTrue(game.ControllCallback(ConsoleKey.Enter));
        }
Beispiel #2
0
        public void GameCallbackArrowsTest()
        {
            Game game = new Game(10, 10);

            Assert.IsFalse(game.ControllCallback(ConsoleKey.DownArrow));
            Assert.IsFalse(game.ControllCallback(ConsoleKey.UpArrow));
            Assert.IsFalse(game.ControllCallback(ConsoleKey.LeftArrow));
            Assert.IsFalse(game.ControllCallback(ConsoleKey.RightArrow));
        }
Beispiel #3
0
        static public void Tick(Object stateInfo)
        {
            if (_isDrawing)
            {
                return;
            }

            _isDrawing = true;

            if (Console.KeyAvailable)
            {
                ConsoleKeyInfo cki = Console.ReadKey(false);
                _exit = _game.ControllCallback(cki.Key);
            }

            Console.Clear();
            _game.Tick();
            _game.Render();
            DrawScreen();

            _isDrawing = false;
        }