예제 #1
0
파일: Program.cs 프로젝트: Chris3606/WinMan
#pragma warning disable RECS0154 // Parameter is never used

        private static void Main(string[] args)
#pragma warning restore RECS0154 // Parameter is never used
        {
            var settings = new RLSettings
            {
                BitmapFile   = "terminal8x8.png",
                Width        = 60,
                Height       = 40,
                CharWidth    = 8,
                CharHeight   = 8,
                Scale        = 1f,
                Title        = "RLNET Window Manager Test",
                WindowBorder = RLWindowBorder.Resizable,
                ResizeType   = RLResizeType.ResizeCells
            };

            // All the test panels here work with resize via scaling as well.
            //settings.ResizeType = RLResizeType.ResizeScale;

            Engine.Init(settings);

            mainGameScreen = new MainGameScreen();
            mainGameScreen.Show();

            Engine.Run();
        }
예제 #2
0
        /// <summary>
        ///     Main entry point for the program
        ///     This is where the program starts here the various settings are set
        ///     and the root console is created we also hook the events handlers
        ///     for each event. Then we start the console.
        /// </summary>
        public static void Main()
        {
            var fontImage = @"iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAIAAABMXPacAAAAB3RJTUUH3wEZFiMyURjM3AAAABd0RVh0U29mdHdhcmUAR0xEUE5HIHZlciAzLjRxhaThAAAACHRwTkdHTEQzAAAAAEqAKR8AAAAEZ0FNQQAAsY8L 
                            / GEFAAAABmJLR0QA / wCAAMBJdqXDAAAJvElEQVR4nO1X0ZIbSQib///puUpdbjMGSQi6xzt7MQ+pNg1CEm0nOQ4eZwonfz0ENDECXglugiQD9Ou1ZI1WjghnJcxnX6py2DsEfErMOEaDwR7JsqwrnFlNuC0EhqL
                            zdbd5nukCFK/1wytWWRoHrWSsBA6UJgyByCqEeD8EG5PlKa3JjkCvr4rydJjMebEA6BIzLSSLBTDXmGBonGbARpRQexfgYIpZIqnlY/ev7JlrEIjhCvb5iuW1vPwReqp1wREs6TBk9HJXDFhx8tCNJaCZ9ynl22uGI
                            cAaCM6sFFDn67Oo1TmqTJsc/DJvktRdol63M5K67JrPBb8Ovn0nWjXL5DM0qOV1qbCVf0o44nMNdA0uwDnk9pIJ3D1EaC2mu62rXg11krD+xgu3ACWNNH1nc5naFh9oROmRrmFXEEqT/H2Ls9U/ByEzRggiw4MTrNj
                            Md/VqWBOKtYCsHqMF52HwVhwU0f5L1/Vsrq4p9eahTEJkCWfAmlKYpguh4Lh867u5Uq/JBD75ULa8jDDtC5UlNFMCe4XLAifTa+V/fKwLYxaXxa3Gnx1QZHjLZZ7hlHNbIOtD3xkWt/JHwFwAfLOs18H39egH1BqxM
                            dwprQWcKMQw4cKBvgED98VtKe2+6I1oVeuX6z9SZ38+SUFGhzPUr3eoLjU4GpjXMOMLay0gs/WhFuNW8JcB10liJbmMJf3RTl6MaOG0+Azdb7VBE01CcGctArc+5y0L2MLkb4w3/XSUvxKw3smHWziUQTGS7Mrn042
                            V76LiA8WEBobunNlsoQdedec6fMzRmq0pgfLRjuvBJt2vj3BWa6IWc9MCRBJKKIXgBbTs0FMZgiNbq4IgrL6EcmJ7b0wGis4CSk7C0BJQL0xn/J21YtbuWhdMKRfgmOUYMcMZLMBPtvJnCgcHBwRiA8RgxobdavZdN
                            wUOI+Pn9dUdIH9jfJs77EVDTuIbcFTP/CRfl+sty2t8yJaRhLcMVivNH1k+DK2BzNmtc0nOz0PM0qYQpXYBcnWGnS0fcmcpzDGX6WS9sJ4NdcB1l9Yl9IZkiIPbSDHHC7gWa6msLIOIPMOHLpRdpa4SJM89kePQz8N
                            fQOkFG8AEsF5Yr4fmuY53or4267+PmaTgU2Ay4xyi3bMjrEvpjgWsaHEwI6vzEiYb2AKhWHHGuZLLyAyN8RRQmg80S881F5CnfOIBAdebr7bXr5wP48VpHEGJAWrr4C3sokCmgG59uH3IArQW4Y95KxZTQCwugI3MV
                            7sW4HAOZ8aqxd+R5u7gfA1TfHZc7GDjAqA2OBqSNCk59TDvL7WADmuEoKKx1DZbQAg9VOgPyLpYo1kW69AsTe+YcU6GucksDreQg5DGRjtWmiMawVzOBeKjhtKGihaRYaaXfPLckn82pFX/iUcEXPyfzflrHO+81eg
                            X60oNAp//IvNhtAaM2bQ8HdQvxniReyLPYL9x5UsxZYzxD/R4Bb4pGWIySqz4fA3Iv71LYZwgMavX7DU+u2rpgl3aTUbA9IcGNI5hMVDHaMe1cgHlleZ28N1DnNsX0BXcHSxIsKustkXVL9ZduXjFBxVXqeyQBTCuj
                            J8JwuwIxSb+XhzoD6vR0p4b52vsgtpF7wfET1HLdsOes0Z4ypqfwqMKwdPZypF+i2ALhmA/c2GTTr2TXzlDPiKfz5Anc1lciXoBElsg11L8SRZjsh8vQNAzcUpRrfAbqVezBbAzZLNrASGEC4I/zOg8u/J3Juj1fjq
                            cqUJwafRBFikWcAXv8jcXw652LsBshpIOrlZwvRYrfikJ3XcaM09WXHotlMLIc3/3atecgmdG+SAeFDOiuQVuOL8+1p7BB/zHc1l9xvdxyo9qsCAkXNAZP/zevXNLfBPcXE8DEaKzAeIFOTjd/Pa5QrJT/5W0vL0Wr
                            ZwFrE6aeXMWFO/zX1cUMnkcwIEXmjTDglesvpUvrQktjKfDX0wpkxn/lA+CYrEGk2I5uHs++AsyrSn5++pEktkIt1LMYD0CBbY4OE6+lC34l8W+LieZP2aB1uCnxU/hOYmWNvhCdy1yC47zwMVjZ5RgGTOB8V9VV36
                            t/LPWv1IPC1rq9uqlaGeKUApjpu39oTmXemGLANf4NFn6mEEF0YzWyjtmtQwNZ7O3RV74cxg7a8yAw5553rWA7pXgQNHggCeY2DL6K7KKGc55WVhugcUQH07BFEtCcJiet5hn+LkLaCNJgZDr9dAy8/UxH/4noVcyB
                            hwXs/0d6b1iLPZYWhp86vpl+XzWSXY5bBw9DO3FSX43fOTD+DpvDHNWuY+czPJjS/e5bQlBaLCAdZ6MjzJuO1RrveJpsP3nem2o7vJJCj6Zc7gSBzid+aBumdoGxPTM5vrBeh3MgbrMdtUif2MT9AVJeTciqc8shJW
                            aKusSUIqbIzij63wgvW6WCMZnAOKcnQV8Yin0Rm9xPKz0eoB/hgfuvIhWHn6BZrogThd/gOMyh9YflftHWkM5+LOAYkA+6x3ksx4My3J7KQxWMhq+cSeKdRzB/A+EOMM/T7SGzAk6Zeb9BZT48LbEN/MCx2f+uzqf9
                            Q7yWVBkZTqfFeauLg4zbnFui881/8O+ASy/C0fg7wqMDNegd5DPasBnAYwntP6o3D/SGuiAUf4vWkB50aWyq37XYvTQ99d/FvDN9T9sAV8RivUCQj2LsoDNNcPHr41YN7RbD/NB2AxkELtw6hnjuBsnGAHzTr3JYTu
                            OqFlamJ/fghOE+eCL9XfPncRnARvnTuKzgI1zt21M4Gx5CwP8lmU5nPouJuj9LOBxC+gSYjiMTZk38UueDuxAb7emwM/CZiFwGHJr4n3437YAp8gCIiMZG53fxSqPa7kzBveXVAfs/0quok//x5u7ukwg8mcBBf5nA
                            TH5WcDtC1gMn+4d+GyoIDPjydbJqDZAGXS4Qi8jPlVzNmthsAy5LGYeGd5QwiUZUACFaRf0YIfQUe2SYYbigFOaUnJjGcYz5LVYMIIJgyPFACFSZ3RxCcWKsztwXCk5NzJANtFdwL9nU9iBwhFZFpfjTGFOmdOrjRZ5
                            pjdyy/3XfEZkA9aFBRwmRteXfLo8Mx9mEWsv8eu/A7R+Rxj0CLqmRzjycp4NFYay6SZPNtcRWKPfGt25YsG3xptm7Xqh16twOxhhIo8jrJNtd89Q/YLYgG7+ehVq/AVkUzTyOBjDLW+lR4ItBg7WVFoLKNt9gwbh4+u
                            HaPHRRusBft5vKRevVbQoabT80X86Xf4ulXKwuF036Cqp21XmBbjOC4sskmcKR9UgTFWwONffwXOwXQ21hMMW080HwPzRXMB74g0P8duCPeqnSX0zq38AkpsLsVLOAuMAAAAASUVORK5CYII=";

            Byte[]       bitmapData   = Convert.FromBase64String(FixBase64ForImage(fontImage));
            MemoryStream bitMapStream = new MemoryStream(bitmapData);
            FileStream   bitFile      = new FileStream(Path.GetTempPath() + "rlFontFile.png", FileMode.Create);

            bitMapStream.WriteTo(bitFile);
            bitFile.Close();
            var settings = new RLSettings();

            settings.BitmapFile       = Path.GetTempPath() + "rlFontFile.png";
            settings.CharWidth        = 8;
            settings.CharHeight       = 8;
            settings.Width            = 91;
            settings.Height           = 56;
            settings.Scale            = 1f;
            settings.Title            = "PythonRouge";
            settings.WindowBorder     = RLWindowBorder.Fixed;
            settings.ResizeType       = RLResizeType.ResizeCells;
            settings.StartWindowState = RLWindowState.Normal;

            _rootConsole = new RLRootConsole(settings);

            _rootConsole.Update += rootConsole_Update;
            _rootConsole.Render += rootConsole_Render;
            _rootConsole.Run(60);
        }
예제 #3
0
		public static void Main ()
		{
			RLSettings setup = new RLSettings ();
			setup.Scale = 1f;
			setup.BitmapFile = "dsc8x12.png";
			setup.CharWidth = 8;
			setup.CharHeight = 12;
			setup.Width = 120;
			setup.Height = 60;
			setup.Title = "coffee";
			game = new RLRootConsole (setup);
			new Engine (game);
			game.Run ();
		}
예제 #4
0
        public static void Main()
        {
            RLSettings setup = new RLSettings();

            setup.Scale      = 1f;
            setup.BitmapFile = "dsc8x12.png";
            setup.CharWidth  = 8;
            setup.CharHeight = 12;
            setup.Width      = 120;
            setup.Height     = 60;
            setup.Title      = "coffee";
            game             = new RLRootConsole(setup);
            new Engine(game);
            game.Run();
        }
예제 #5
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                if (args[0] == "full")
                {
                    fullScreen = true;
                }
            }

            var font         = "civGraphics.png";
            var consoleTitle = "CivSharp";
            var charHeight   = 8;
            var charWidth    = 8;
            var scale        = 1.6f;
            var settings     = new RLSettings();

            settings.Width            = _screenWidth;
            settings.Height           = _screenHeight;
            settings.BitmapFile       = font;
            settings.Title            = consoleTitle;
            settings.CharHeight       = charHeight;
            settings.CharWidth        = charWidth;
            settings.Scale            = scale;
            settings.WindowBorder     = RLWindowBorder.Fixed;
            settings.StartWindowState = fullScreen ? RLWindowState.Fullscreen : RLWindowState.Normal;

            _rootConsole = new RLRootConsole(settings);

            _mapConsole     = new RLConsole(_mapWidth, _mapHeight);
            _commandConsole = new RLConsole(_commandWidth, _commandHeight);
            _unitConsole    = new RLConsole(_unitWidth, _unitHeight);

            var generator = new WorldGenerator(_mapWidth, _mapHeight);

            world = generator.GenerateWorldNew();

            _inputHandler = new InputHandler(_rootConsole.Keyboard, world, _unitConsole,
                                             (_mapRenderWidth, _mapRenderHeight));

            //Pass render height/width because we add them as offsets.
            _rootConsole.Update += OnRootConsoleUpdate;
            _rootConsole.Render += OnRootConsoleRender;
            _rootConsole.Run();
        }
예제 #6
0
        public static void Main()
        {
            RLSettings settings = new RLSettings();

            settings.BitmapFile       = "ascii_8x8.png";
            settings.CharWidth        = 8;
            settings.CharHeight       = 8;
            settings.Width            = 60;
            settings.Height           = 40;
            settings.Scale            = 1f;
            settings.Title            = "RLNET Sample";
            settings.WindowBorder     = RLWindowBorder.Resizable;
            settings.ResizeType       = RLResizeType.ResizeCells;
            settings.StartWindowState = RLWindowState.Normal;

            rootConsole         = new RLRootConsole(settings);
            rootConsole.Update += rootConsole_Update;
            rootConsole.Render += rootConsole_Render;
            rootConsole.OnLoad += rootConsole_OnLoad;
            rootConsole.Run();
        }
예제 #7
0
        /// <summary>
        ///     Main entry point for the program
        ///     This is where the program starts here the various settings are set
        ///     and the root console is created we also hook the events handlers
        ///     for each event. Then we start the console.
        /// </summary>
        public static void Main()
        {
            var settings = new RLSettings();

            settings.BitmapFile       = "ascii_8x8.png";
            settings.CharWidth        = 8;
            settings.CharHeight       = 8;
            settings.Width            = 90;
            settings.Height           = 70;
            settings.Scale            = 1f;
            settings.Title            = "PythonRouge";
            settings.WindowBorder     = RLWindowBorder.Fixed;
            settings.ResizeType       = RLResizeType.ResizeCells;
            settings.StartWindowState = RLWindowState.Normal;

            _rootConsole = new RLRootConsole(settings);

            _rootConsole.Update += rootConsole_Update;
            _rootConsole.Render += rootConsole_Render;
            _rootConsole.Run();
        }
예제 #8
0
        static private KeyHandler globalKeyHandler; // handles global keys like fullscreen and exit

        static void Main()
        {
            var settings = new RLSettings
            {
                BitmapFile       = "font14x14.png",
                CharWidth        = 14,
                CharHeight       = 14,
                Width            = 80,
                Height           = 45,
                ResizeType       = RLResizeType.ResizeCells, // Display more tiles on screen if the console gets bigger, dont just increase size of existing
                Scale            = 1f,
                StartWindowState = RLWindowState.Normal,
                WindowBorder     = RLWindowBorder.Resizable,
                Title            = "Apprentice"
            };

            Engine.Init(settings);

            // Generate new world
            World = new GameWorld(30, 30, 50, 50);

            // For now we just spawn player at random position in the demi-plane
            Coord playerSpawn = Map.RandomOpenPosition(World.DemiPlane, SingletonRandom.DefaultRNG);

            Player = new Player(playerSpawn);
            World.DemiPlane.Add(Player); // Changes active map too

            // Global key commands setup
            globalKeyHandler = new GlobalKeyHandler();
            globalKeyHandler.StartHandling();

            // UI setup
            GameScreen         = new GameScreen();
            SpellsPanel        = new SpellsPanel(Screen.SizeC(0), Screen.SizeC(0), Screen.WidthMinus(0), Screen.HeightMinus(0));
            MessageRecallPanel = new MessageRecallPanel(Screen.SizeC(0), Screen.SizeC(0), Screen.WidthMinus(0), Screen.HeightMinus(0));

            // Show UI and get game underway
            GameScreen.Show();
            Engine.Run();
        }
예제 #9
0
        /// <summary>
        /// Just initializes RLRootConsole. Don't call more than once, should just be likely at the start of your main.  WILL ERROR IF CALLED MORE THAN ONCE
        /// </summary>
        /// <param name="settings">Settings passed to root console to initialize.</param>
        public static void Init(RLSettings settings)
        {
            if (RootConsole == null)
            {
                if (settings.StartWindowState == RLWindowState.Fullscreen)
                {
                    Fullscreen = true;
                }
                else
                {
                    Fullscreen = false;
                }

                RootConsole         = new RLRootConsole(settings);
                RootConsole.Update += onUpdate;
                RootConsole.Render += onRender;
            }
            else
            {
                throw new Exception("Init already called!");
            }
        }
예제 #10
0
        public static void Main()
        {
            ResetSimulation();

            RLSettings settings = new RLSettings();

            settings.BitmapFile = "ascii_8x8.png";
            settings.CharWidth  = 8;
            settings.CharHeight = 8;
            settings.Width      = problem.Map.Width;
            settings.Height     = problem.Map.Height;
            settings.Scale      = 0.25f;
            settings.Title      = "RLNET Sample";
            //settings.WindowBorder = RLWindowBorder.Resizable;
            //settings.ResizeType = RLResizeType.ResizeCells;
            //settings.StartWindowState = RLWindowState.Normal;

            rootConsole         = new RLRootConsole(settings);
            rootConsole.Render += rootConsole_Render;
            rootConsole.Update += rootConsole_Update;

            rootConsole.Run();
        }
예제 #11
0
        public NokiaMenu() : base(null)
        {
            var settings = new RLSettings
            {
                Title            = "Nokia 3310",
                BitmapFile       = "font_16x16.png",
                CharHeight       = 16,
                CharWidth        = 16,
                Width            = ScreenWidth,
                Height           = ScreenHeight,
                Scale            = 1,
                ResizeType       = RLResizeType.ResizeCells,
                StartWindowState = RLWindowState.Normal,
                WindowBorder     = RLWindowBorder.Fixed
            };

            Console   = new RLRootConsole(settings);
            menuItems = new List <NokiaApp>
            {
                new SnakeGame(this, Console),
                new TanksGame(this, Console),
                new HelloWorldApp(this, Console)
            };
        }
예제 #12
0
        public void NavigateTo(MainWindowPage page)
        {
            // Needed to save the content of the LoliCode editor when changing page
            if (CurrentPage == configEditorPage)
            {
                configEditorPage?.OnPageChanged();
            }

            switch (page)
            {
            case MainWindowPage.Home:
                homePage = new Home();     // We recreate the homepage each time to display updated announcements
                ChangePage(homePage, menuOptionHome);
                break;

            case MainWindowPage.Jobs:
                if (jobsPage is null)
                {
                    jobsPage = new();
                }
                ChangePage(jobsPage, menuOptionJobs);
                break;

            case MainWindowPage.Monitor:
                if (monitorPage is null)
                {
                    monitorPage = new();
                }
                ChangePage(monitorPage, menuOptionMonitor);
                break;

            case MainWindowPage.Proxies:
                if (proxiesPage is null)
                {
                    proxiesPage = new();
                }
                proxiesPage.UpdateViewModel();
                ChangePage(proxiesPage, menuOptionProxies);
                break;

            case MainWindowPage.Wordlists:
                if (wordlistsPage is null)
                {
                    wordlistsPage = new();
                }
                ChangePage(wordlistsPage, menuOptionWordlists);
                break;

            case MainWindowPage.Configs:
                if (configsPage is null)
                {
                    configsPage = new();
                }
                configsPage.UpdateViewModel();
                ChangePage(configsPage, menuOptionConfigs);
                break;

            case MainWindowPage.Hits:
                if (hitsPage is null)
                {
                    hitsPage = new();
                }
                hitsPage.UpdateViewModel();
                ChangePage(hitsPage, menuOptionHits);
                break;

            case MainWindowPage.Plugins:
                if (pluginsPage is null)
                {
                    pluginsPage = new();
                }
                ChangePage(pluginsPage, menuOptionPlugins);
                break;

            case MainWindowPage.OBSettings:
                if (obSettingsPage is null)
                {
                    obSettingsPage = new();
                }
                ChangePage(obSettingsPage, menuOptionOBSettings);
                break;

            case MainWindowPage.RLSettings:
                if (rlSettingsPage is null)
                {
                    rlSettingsPage = new();
                }
                ChangePage(rlSettingsPage, menuOptionRLSettings);
                break;

            case MainWindowPage.About:
                if (aboutPage is null)
                {
                    aboutPage = new();
                }
                ChangePage(aboutPage, menuOptionAbout);
                break;

            // Initialize config pages when we click on them because a user might not even load them
            // so we save some RAM (especially the heavy ones that involve a WebBrowser control)

            case MainWindowPage.ConfigMetadata:
                CloseSubmenu();
                if (configMetadataPage is null)
                {
                    configMetadataPage = new();
                }
                configMetadataPage.UpdateViewModel();
                ChangePage(configMetadataPage, menuOptionMetadata);
                break;

            case MainWindowPage.ConfigReadme:
                CloseSubmenu();
                if (configReadmePage is null)
                {
                    configReadmePage = new();
                }
                configReadmePage.UpdateViewModel();
                ChangePage(configReadmePage, menuOptionReadme);
                break;

            case MainWindowPage.ConfigStacker:

                if (vm.Config.Mode is not ConfigMode.Stack and not ConfigMode.LoliCode)
                {
                    return;
                }

                CloseSubmenu();
                if (configEditorPage is null)
                {
                    configEditorPage = new();
                }
                configEditorPage.NavigateTo(ConfigEditorSection.Stacker);
                ChangePage(configEditorPage, menuOptionStacker);
                break;

            case MainWindowPage.ConfigLoliCode:

                if (vm.Config.Mode is not ConfigMode.Stack and not ConfigMode.LoliCode)
                {
                    return;
                }

                CloseSubmenu();
                if (configEditorPage is null)
                {
                    configEditorPage = new();
                }
                configEditorPage.NavigateTo(ConfigEditorSection.LoliCode);
                ChangePage(configEditorPage, menuOptionLoliCode);
                break;

            case MainWindowPage.ConfigSettings:
                CloseSubmenu();
                if (configSettingsPage is null)
                {
                    configSettingsPage = new();
                }
                configSettingsPage.UpdateViewModel();
                ChangePage(configSettingsPage, menuOptionConfigSettings);
                break;

            case MainWindowPage.ConfigCSharpCode:

                if (vm.Config.Mode is not ConfigMode.Stack and not ConfigMode.LoliCode and not ConfigMode.CSharp)
                {
                    return;
                }

                CloseSubmenu();
                if (configEditorPage is null)
                {
                    configEditorPage = new();
                }
                configEditorPage.NavigateTo(ConfigEditorSection.CSharp);
                ChangePage(configEditorPage, menuOptionCSharpCode);
                break;
            }
        }