Example #1
0
        static void Main(string[] args)
        {
            Console.SetBufferSize(101, 46);

            Console.SetWindowSize(100, 45);

            Console.CursorVisible = false;

            Editor.Init();

            //ModoEleccion();

            // Menu Principal
            bool salir = true;

            do
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo tecla = Console.ReadKey(true);
                    Menu.Principal(tecla);
                    if (tecla.Key == ConsoleKey.Escape)
                    {
                        salir = false;
                    }
                }
                Menu.Visualizar();

                Escenario.Imprimir();
            } while (salir);

            /*
             * while (true)
             * {
             *  //Pantalla.BorrarPantalla();
             *
             *  if (Console.KeyAvailable)
             *  {
             *      ConsoleKeyInfo tecla = Console.ReadKey(true);
             *      Editor.Mover(tecla);
             *      if (tecla.Key == ConsoleKey.Escape)
             *      {
             *          ModoEleccion();
             *      }
             *  }
             *
             *  Editor.Dibujar();
             *
             *  Escenario.Imprimir();
             *
             *  Pantalla.Dibujar();
             * }
             */
        }
Example #2
0
        public static void CargarObjeto(int obj)
        {
            switch (obj)
            {
            case 0: Escenario.AgregarObjeto(new Obstaculo(Convert.ToInt32(campos[1].Trim()), Convert.ToInt32(campos[2].Trim())));
                break;

            case 1: Escenario.AgregarObjeto(new Plataforma(Convert.ToInt32(campos[1].Trim()), Convert.ToInt32(campos[2].Trim())));
                break;
            }
        }
Example #3
0
        public static void CrearObjeto()
        {
            switch (obj)
            {
            case 0: Escenario.AgregarObjeto(new Obstaculo(pos.x, (int)pos.y));
                CrearMapa("0");
                break;

            case 1: Escenario.AgregarObjeto(new Plataforma(pos.x, (int)pos.y));
                CrearMapa("1");
                break;
            }
        }
Example #4
0
        public static void Mover(ConsoleKeyInfo tecla)
        {
            foreach (ObjEscenario obj in LObj)
            {
                obj.Borrar();
            }

            if (tecla.Key == izq)
            {
                pos.x--;
            }

            if (tecla.Key == der)
            {
                pos.x++;
            }

            if (tecla.Key == up)
            {
                pos.y--;
            }

            if (tecla.Key == down)
            {
                pos.y++;
            }

            if (tecla.Key == enter)
            {
                Editor.CrearObjeto();
            }

            if (tecla.Key == guardar)
            {
                escribir.Close();
            }

            if (tecla.Key == ConsoleKey.Delete)
            {
                Escenario.QuitarUltObjeto();
            }
        }
Example #5
0
        static public void ModoEleccion()
        {
            bool fin = true;

            do
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo tecla = Console.ReadKey(true);
                    fin = Editor.Eleccion(tecla);
                }

                Editor.Dibujar();

                Pantalla.Dibujar();
            } while (fin);

            while (true)
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo tecla = Console.ReadKey(true);
                    Editor.Mover(tecla);
                    if (tecla.Key == ConsoleKey.Escape)
                    {
                        ModoEleccion();
                    }
                }

                Editor.Dibujar();

                Escenario.Imprimir();

                Pantalla.Dibujar();
            }
        }