Example #1
0
        public void Run()
        {
            Console.Clear();
            Console.CursorVisible = false;
            Console.SetWindowSize(P_Const.CONSOLE_WIDTH, P_Const.CONSOLE_HEIGHT);
            Console.SetBufferSize(P_Const.CONSOLE_WIDTH, P_Const.CONSOLE_HEIGHT);
            P_Render        Renderer = new P_Render();
            P_InputMap      Inputer  = new P_InputMap();
            P_UpdateManager Updater  = new P_UpdateManager(Inputer);
            P_MainMenu      MainMenu = new P_MainMenu(Renderer, Updater);

            PrototypeTextBox.P_DisplayBox background = new PrototypeTextBox.P_DisplayBox(Updater, Renderer);
            background.DismissUpdater(Updater);
            background.Render.Visable = true;
            background.Render.Graphic = new char[P_Const.CONSOLE_WIDTH * P_Const.CONSOLE_HEIGHT];
            for (int i = 0; i < background.Render.Graphic.Length; i++)
            {
                background.Render.Graphic[i] = ' ';
            }
            background.Render.RenderLayer = RenderLayerEnum.Background;

            MainMenu.Start();

            while (Updater.CallUpdate())
            {
                Renderer.RenderScreen();
                Inputer.ProtoInput();
            }
            //Renderer.RenderScreen();
            //Console.ReadKey(true);
            //TODO: ProtoBattle.Run(ProtoMap, ProtoActors);
        }
        public P_MainMenu(P_Render renderer, IP_UpdateManager updater)
        {
            _Render         = new TilerIsADummy.PrototypeMapGen.PrototypeComponents.P_MainMenuRenderComponent(this);
            _Render.Graphic = new char[_Render.SizeX * _Render.SizeY];
            ConsoleBuffer imbad = new ConsoleBuffer(_Render.SizeX, _Render.SizeY);

            imbad.BufferWritePosition((_Render.SizeX / 2) - (MenuHeading.Length / 2), (_Render.SizeY) / 2);
            imbad.BufferWrite(MenuHeading);
            imbad.BufferWritePosition(_Render.SizeX + 1, _Render.SizeY - 3);
            imbad.BufferWrite(PressFooConfirm);
            imbad.BufferWritePosition(_Render.SizeX + 1, _Render.SizeY - 2);
            imbad.BufferWrite(PressFooExit);
            imbad.BufferWritePosition(0, 0);
            //imbad.BufferWrite("Such is the secret core of your creed, the other half of your double standard: it is immoral to live by your own effort, but moral to live by the effort of others—it is immoral to consume your own product, but moral to consume the products of others—it is immoral to earn, but moral to mooch—it is the parasites who are the moral justification for the existence of the producers, but the existence of the parasites is an end in itself—it is evil to profit by achievement, but good to profit by sacrifice—it is evil to create your own happiness, but good to enjoy it at the price of the blood of others. Your code divides mankind into two castes and commands them to live by opposite rules: those who may desire anything and those who may desire nothing, the chosen and the demand, the riders and the carriers, the eaters and the eaten. What standard determines your caste? What passkey admits you to the moral elite? The passkey is lack of value. Whatever the value involved, it is your lack of it that gives you a claim upon those who don’t lack it. It is your need that gives you a claim to rewards. If you are able to satisfy your need, your ability annuls your right to satisfy it. But a need you are unable to satisfy gives you first right to the lives of mankind. If you succeed, any man who fails is your master; if you fail, any man who succeeds is your serf. Whether your failure is just or not, whether your wishes are rational or not, whether your misfortune is undeserved or the result of your vices, it is misfortune that gives you a right to rewards. It is pain, regardless of its nature or cause, pain as a primary absolute, that gives you a mortgage on all of existence.");
            _Render.Graphic = imbad.bufferarray;


            Renderer = renderer;
            Updater  = updater;

            this.AcceptP_Render(Renderer);
            this.AcceptUpdater(Updater);
        }
 public void DismissP_Render(PrototypeMapGen.P_Render P_Render)
 {
     P_Render.P_RenderUnsubscribe(this._Render, this._Render.RenderLayer);
 }
 public void AcceptP_Render(PrototypeMapGen.P_Render P_Render)
 {
     P_Render.P_RenderSubscribe(this._Render, this._Render.RenderLayer);
 }
        public static void Run()
        {
            //IConsoleBuffer PrototypeBuffer = buffer;
            Console.Clear();
            Console.CursorVisible = false;

            Console.SetWindowSize(P_Const.CONSOLE_WIDTH, P_Const.CONSOLE_HEIGHT);
            Console.SetBufferSize(P_Const.CONSOLE_WIDTH, P_Const.CONSOLE_HEIGHT);
            P_Render        Renderer  = new P_Render();
            P_UpdateManager Updater   = new P_UpdateManager(new P_InputMap());
            P_MainMenu      MainMenu3 = new P_MainMenu(Renderer, Updater);
            P_MainMenu      MainMenu  = new P_MainMenu(Renderer, Updater);
            P_MainMenu      MainMenu2 = new P_MainMenu(Renderer, Updater);

            MainMenu3.Render.ForegroundColor = ConsoleColor.Black;
            MainMenu3.Render.BackgroundColor = ConsoleColor.White;
            MainMenu2.Render.ForegroundColor = ConsoleColor.Magenta;
            MainMenu2.Render.BackgroundColor = ConsoleColor.DarkBlue;

            MainMenu2.Render.OffsetBoss = MainMenu;

            MainMenu.AcceptP_Render(Renderer);

            MainMenu2.AcceptP_Render(Renderer);

            MainMenu3.AcceptP_Render(Renderer);

            //Console.ReadKey(true);

            double previous = (float)DateTime.Now.TimeOfDay.TotalMilliseconds;
            double lag      = 0.0;
            int    x        = -100;
            int    y        = -70;

            while (x < 100)
            {
                double current = (float)DateTime.Now.TimeOfDay.TotalMilliseconds;
                double elapsed = current - previous;
                previous = current;
                lag     += elapsed;
                while (lag >= 16)
                {
                    if (x < 100)
                    {
                        x++;
                    }
                    else
                    {
                        x = -70;
                        y++;
                    }
                    MainMenu.Render.MyXCoords  = x;
                    MainMenu2.Render.MyXCoords = -0;
                    MainMenu.Render.MyYCoords  = 0;
                    MainMenu2.Render.MyYCoords = -x;
                    lag -= 16;
                }
                Renderer.RenderScreen();
                //System.Threading.Thread.Sleep(2);
            }
            //Renderer.RenderScreen();

            /*
             * P_DefaultEntityList ProtoActors = new P_DefaultEntityList();
             * P_TileArray ProtoMap = PrototypeMapGen.GenerateRandomMap(P_Const.CONSOLE_WIDTH/2-2, P_Const.CONSOLE_HEIGHT-2, Renderer);
             * PrototypeBattleMap ProtoBattle = new PrototypeBattleMap(ProtoActors, ProtoMap, Updater, Renderer);
             */
            //Renderer.RenderScreen();
            //Console.ReadKey(true);
            //TODO: ProtoBattle.Run(ProtoMap, ProtoActors);
        }