Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var eventLoop = new EventLoop();

            using (var sw = new StreamWriter("test.txt"))
            {
                sw.Write(@"## ##
#@  #
##   
     
# # #");
            }

            var controller = new CursorController(@"test.txt", Console.SetCursorPosition);

            File.Delete("test.txt");

            eventLoop.LeftHandler  += controller.OnLeft;
            eventLoop.RightHandler += controller.OnRight;
            eventLoop.UpHandler    += controller.OnUp;
            eventLoop.DownHandler  += controller.OnDown;

            controller.Print();

            eventLoop.Run();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.CursorVisible = false;
            try
            {
                var eventLoop = new EventLoop();
                var game      = new Game("map.txt");

                eventLoop.LeftHandler  += game.OnLeft;
                eventLoop.RightHandler += game.OnRight;
                eventLoop.UpHandler    += game.Up;
                eventLoop.DownHandler  += game.Down;

                eventLoop.Run();
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("Map file not found");
            }
        }
Exemplo n.º 3
0
        static void Main()
        {
            try
            {
                var game      = new Game("Map.txt");
                var eventLoop = new EventLoop();

                eventLoop.LeftHandler  += game.OnLeft;
                eventLoop.RightHandler += game.OnRight;
                eventLoop.TopHandler   += game.OnTop;
                eventLoop.DownHandler  += game.OnDown;

                eventLoop.Run();
            }
            catch (FileNotFoundException exception)
            {
                Console.WriteLine(exception.Message);
            }
            catch (IncorrectMapException exception)
            {
                Console.WriteLine(exception.Message);
            }
        }