Наследование: SadConsole.Consoles.Window
Пример #1
0
        private static void Init()
        {
            // Any setup
            if (Settings.UnlimitedFPS)
            {
                SadConsole.Game.Instance.Components.Add(new SadConsole.Game.FPSCounterComponent(SadConsole.Game.Instance));
            }

            // Setup our custom theme.
            Theme.SetupThemes();

            SadConsole.Game.Instance.Window.Title = "DemoProject OpenGL";

            // By default SadConsole adds a blank ready-to-go console to the rendering system.
            // We don't want to use that for the sample project so we'll remove it.

            //Global.MouseState.ProcessMouseWhenOffScreen = true;

            Console ctx = new Console(10, 10);

            MainConsole = new Container();

            // We'll instead use our demo consoles that show various features of SadConsole.
            Global.CurrentScreen = MainConsole;

            // Initialize the windows
            _characterWindow = new Windows.CharacterViewer();
        }
Пример #2
0
        protected override void Initialize()
        {
            // Let the XNA framework show the mouse.
            IsMouseVisible  = true;
            IsFixedTimeStep = true;

            // Uncomment these two lines to run as fast as possible
            //_graphics.SynchronizeWithVerticalRetrace = false;
            //IsFixedTimeStep = false;

            // Initialize the SadConsole engine and the first effects library (provided by the SadConsole.Effects.dll binary)
            SadConsole.Engine.Initialize(GraphicsDevice);

            // Tell SadConsole to track the mouse.
            SadConsole.Engine.UseMouse = true;

            // Load the default font.
            using (var stream = System.IO.File.OpenRead("Fonts/IBM.font"))
                SadConsole.Engine.DefaultFont = SadConsole.Serializer.Deserialize <Font>(stream);

            // Using the default font, resize the window to a Width,Height of cells. This example uses the MS-DOS default of 80 columns by 25 rows.
            SadConsole.Engine.DefaultFont.ResizeGraphicsDeviceManager(_graphics, 80, 25, 0, 0);

            // Create the default console, show the cursor, and let the console accept keyboard input.
            _defaultConsole = new Console(80, 25);
            _defaultConsole.VirtualCursor.IsVisible = true;
            _defaultConsole.CanUseKeyboard          = true;

            // Add the default console to the list of consoles.
            SadConsole.Engine.ConsoleRenderStack.Add(_defaultConsole);


            // If you want to use the custom console demo provided by this starter project, uncomment out the line below.
            SadConsole.Engine.ConsoleRenderStack = new ConsoleList()
            {
                new CustomConsoles.CursorConsole(),
                new CustomConsoles.WorldGenerationConsole(),
                new CustomConsoles.StaticConsole(),
                new CustomConsoles.StretchedConsole(),
                new CustomConsoles.BorderedConsole(80, 25),
                new CustomConsoles.DOSConsole(),
                new CustomConsoles.WindowTestConsole(),
                new CustomConsoles.EntityAndConsole(),
                new CustomConsoles.RandomScrollingConsole(),
                new CustomConsoles.SplashScreen(),
            };

            SadConsole.Engine.ConsoleRenderStack[0].IsVisible = true;

            // Set the first console in the console list as the "active" console. This allows the keyboard to be processed on the console.
            SadConsole.Engine.ActiveConsole = SadConsole.Engine.ConsoleRenderStack[0];

            // Initialize the windows
            _characterWindow = new Windows.CharacterViewer();

            //Components.Add(new FPSCounterComponent(this));

            // Call the default initialize of the base class.
            base.Initialize();
        }
Пример #3
0
        private static void Init()
        {
            // Any setup
            if (Settings.UnlimitedFPS)
            {
                SadConsole.Game.Instance.Components.Add(new SadConsole.Game.FPSCounterComponent(SadConsole.Game.Instance));
            }

            // Setup our custom theme.
            Theme.SetupThemes();

            SadConsole.Game.Instance.Window.Title = "DemoProject Core";

            // By default SadConsole adds a blank ready-to-go console to the rendering system.
            // We don't want to use that for the sample project so we'll remove it.

            //Global.MouseState.ProcessMouseWhenOffScreen = true;

            MainConsole = new Container();

            // We'll instead use our demo consoles that show various features of SadConsole.
            Global.CurrentScreen = MainConsole;

            // Initialize the windows
            _characterWindow = new Windows.CharacterViewer();


            Console con = new Console(80, 25);

            con.Print(1, 1, "Hello, welcome to SadConsole", Color.Yellow);
            con.SetForeground(4, 1, Color.Brown);
            con.SetForeground(5, 1, Color.Brown);
            con.SetGlyph(6, 1, '!');
            con.Cursor.Move(1, 20).Print("Printing with cursor");
        }
Пример #4
0
        protected override void Initialize()
        {
            // Let the XNA framework show the mouse.
            IsMouseVisible = true;
            IsFixedTimeStep = true;

            // Initialize the SadConsole engine and the first effects library (provided by the SadConsole.Effects.dll binary)
            SadConsole.Engine.Initialize(GraphicsDevice);

            // Tell SadConsole to track the mouse.
            SadConsole.Engine.UseMouse = true;

            // Load the default font.
            using (var stream = System.IO.File.OpenRead("Fonts/IBM.font"))
                SadConsole.Engine.DefaultFont = SadConsole.Serializer.Deserialize<Font>(stream);

            // Using the default font, resize the window to a Width,Height of cells. This example uses the MS-DOS default of 80 columns by 25 rows.
            SadConsole.Engine.DefaultFont.ResizeGraphicsDeviceManager(_graphics, 80, 25, 0, 0);

            // Create the default console, show the cursor, and let the console accept keyboard input.
            _defaultConsole = new Console(80, 25);
            _defaultConsole.VirtualCursor.IsVisible = true;
            _defaultConsole.CanUseKeyboard = true;

            // Add the default console to the list of consoles.
            SadConsole.Engine.ConsoleRenderStack.Add(_defaultConsole);
            
            // If you want to use the custom console demo provided by this starter project, uncomment out the line below.
            SadConsole.Engine.ConsoleRenderStack = new ConsoleList() { new CustomConsoles.CursorConsole(), 
                                                                       new CustomConsoles.StaticConsole(), 
                                                                       new CustomConsoles.StretchedConsole(), 
                                                                       new CustomConsoles.BorderedConsole(80, 25), 
                                                                       new CustomConsoles.DOSConsole(),
                                                                       new CustomConsoles.WindowTestConsole(),
                                                                       new CustomConsoles.EntityAndConsole(),
                                                                       new CustomConsoles.RandomScrollingConsole(),
                                                                       new CustomConsoles.SplashScreen(),
                                                                     };
            SadConsole.Engine.ConsoleRenderStack[0].IsVisible = true;

            // Set the first console in the console list as the "active" console. This allows the keyboard to be processed on the console.
            SadConsole.Engine.ActiveConsole = SadConsole.Engine.ConsoleRenderStack[0];

            // Initialize the windows
            _characterWindow = new Windows.CharacterViewer();

            // Call the default initialize of the base class.
            base.Initialize();
        }
Пример #5
0
        private static void Engine_EngineStart(object sender, EventArgs e)
        {
            // Setup our custom theme.
            Theme.SetupThemes();

            // By default SadConsole adds a blank ready-to-go console to the rendering system.
            // We don't want to use that for the sample project so we'll remove it.
            SadConsole.Engine.ConsoleRenderStack.Clear();
            SadConsole.Engine.ActiveConsole = null;

            // We'll instead use our demo consoles that show various features of SadConsole.
            SadConsole.Engine.ConsoleRenderStack
                = new ConsoleList()
                {
                new ScrollingConsole(10, 10, 20),

                new CustomConsoles.SplashScreen()
                {
                    SplashCompleted = () => { MoveNextConsole(); }
                },
                new CustomConsoles.StretchedConsole(),
                //new CustomConsoles.CachedConsoleConsole(),
                new CustomConsoles.StringParsingConsole(),
                //new CustomConsoles.CursorConsole(),
                //new CustomConsoles.DOSConsole(),
                //new CustomConsoles.SceneProjectionConsole(),
                new CustomConsoles.ControlsTest(),
                new CustomConsoles.ViewsAndSubViews(),
                new CustomConsoles.StaticConsole(),
                new CustomConsoles.BorderedConsole(),
                new CustomConsoles.GameObjectConsole(),
                new CustomConsoles.RandomScrollingConsole(),
                new CustomConsoles.WorldGenerationConsole(),
                };

            // Show the first console (by default all of our demo consoles are hidden)
            SadConsole.Engine.ConsoleRenderStack[0].IsVisible = true;

            // Set the first console in the console list as the "active" console. This allows the keyboard to be processed on the console.
            SadConsole.Engine.ActiveConsole = SadConsole.Engine.ConsoleRenderStack[0];

            // Initialize the windows
            _characterWindow = new Windows.CharacterViewer();

            //SadConsole.Effects.Fade a = new SadConsole.Effects.Fade();
            //a.DestinationForeground = Microsoft.Xna.Framework.Color.Turquoise;
            //SadConsole.Engine.MonoGameInstance.Components.Add(new FPSCounterComponent(SadConsole.Engine.MonoGameInstance));
        }
Пример #6
0
        private static void Engine_EngineStart(object sender, EventArgs e)
        {
            // Setup our custom theme.
            Theme.SetupThemes();
            // By default SadConsole adds a blank ready-to-go console to the rendering system.
            // We don't want to use that for the sample project so we'll remove it.
            SadConsole.Engine.ConsoleRenderStack.Clear();
            SadConsole.Engine.ActiveConsole = null;
            SadConsole.Engine.ProcessMouseWhenOffScreen = true;

            // We'll instead use our demo consoles that show various features of SadConsole.
            SadConsole.Engine.ConsoleRenderStack
                = new ConsoleList() {
                    //new CustomConsoles.CachedConsoleConsole(),

                                        new CustomConsoles.AutoTypingConsole(),
                                        //new CustomConsoles.SplashScreen() { SplashCompleted = () => { MoveNextConsole(); } },
                                        new CustomConsoles.StringParsingConsole(),
                                        new CustomConsoles.ControlsTest(),
                                        new CustomConsoles.DOSConsole(),
                                        new CustomConsoles.FadingExample(),
                                        new CustomConsoles.AnsiConsole(),
                                        new CustomConsoles.ViewsAndSubViews(),
                                        new CustomConsoles.StaticConsole(),
                                        new CustomConsoles.StretchedConsole(),
                                        new CustomConsoles.RandomScrollingConsole(),
                                        new CustomConsoles.SceneProjectionConsole(),
                                        new CustomConsoles.BorderedConsole(),
                                        new CustomConsoles.GameObjectConsole(),
                                        new CustomConsoles.WorldGenerationConsole(),
                                    };

            // Show the first console (by default all of our demo consoles are hidden)
            SadConsole.Engine.ConsoleRenderStack[0].IsVisible = true;

            // Set the first console in the console list as the "active" console. This allows the keyboard to be processed on the console.
            SadConsole.Engine.ActiveConsole = SadConsole.Engine.ConsoleRenderStack[0];

            // Initialize the windows
            _characterWindow = new Windows.CharacterViewer();

            //SadConsole.Effects.Fade a = new SadConsole.Effects.Fade();
            //a.DestinationForeground = Microsoft.Xna.Framework.Color.Turquoise;
            //SadConsole.Engine.MonoGameInstance.Components.Add(new FPSCounterComponent(SadConsole.Engine.MonoGameInstance));
        }
Пример #7
0
        private static void Init()
        {
            // Any setup
            if (Settings.UnlimitedFPS)
            {
                SadConsole.Game.Instance.Components.Add(new SadConsole.Game.FPSCounterComponent(SadConsole.Game.Instance));
            }

            // Setup our custom theme.
            Theme.SetupThemes();

            SadConsole.Game.Instance.Window.Title = "DemoProject Core";

            // By default SadConsole adds a blank ready-to-go console to the rendering system.
            // We don't want to use that for the sample project so we'll remove it.

            //Global.MouseState.ProcessMouseWhenOffScreen = true;

            MainConsole = new Container();

            // We'll instead use our demo consoles that show various features of SadConsole.
            Global.CurrentScreen = MainConsole;
            //Global.CurrentScreen.Print(1, 1, "Test".CreateColored(ColorAnsi.CyanBright, ColorAnsi.Cyan), ColorAnsi.BlueBright, ColorAnsi.Blue);

            var console = new SadConsole.ControlsConsole(50, 30)
            {
                new SadConsole.Controls.Button(7, 1)
                {
                    Text     = "Click",
                    Position = new Point(5, 5)
                }
            };

            console.Invalidated += (s, e) =>
            {
                Rectangle boxArea = console.Controls[0].Bounds;
                boxArea.Inflate(1, 1);
                ((ControlsConsole)s).DrawBox(boxArea, new Cell(Color.Yellow), null, CellSurface.ConnectedLineThin);
            };


            // Initialize the windows
            _characterWindow = new Windows.CharacterViewer();
        }
Пример #8
0
        private static void Engine_EngineStart(object sender, EventArgs e)
        {
            // Setup our custom theme.
            Theme.SetupThemes();

            // By default SadConsole adds a blank ready-to-go console to the rendering system.
            // We don't want to use that for the sample project so we'll remove it.
            SadConsole.Engine.ConsoleRenderStack.Clear();
            SadConsole.Engine.ActiveConsole = null;

            // We'll instead use our demo consoles that show various features of SadConsole.
            SadConsole.Engine.ConsoleRenderStack
                = new ConsoleList()
                {
                new CustomConsoles.RandomScrollingConsole(),
                new CustomConsoles.SplashScreen()
                {
                    SplashCompleted = () => { MoveNextConsole(); }
                },
                new CustomConsoles.StretchedConsole(),
                new CustomConsoles.StringParsingConsole(),
                new CustomConsoles.ControlsTest(),
                new CustomConsoles.FadingExample(),
                new CustomConsoles.DOSConsole(),
                new CustomConsoles.ViewsAndSubViews(),
                new CustomConsoles.AnsiConsole(),
                new CustomConsoles.StaticConsole(),
                new CustomConsoles.BorderedConsole(),
                new CustomConsoles.GameObjectConsole(),
                new CustomConsoles.WorldGenerationConsole(),
                };

            // Show the first console (by default all of our demo consoles are hidden)
            SadConsole.Engine.ConsoleRenderStack[0].IsVisible = true;

            // Set the first console in the console list as the "active" console. This allows the keyboard to be processed on the console.
            SadConsole.Engine.ActiveConsole = SadConsole.Engine.ConsoleRenderStack[0];

            // Initialize the windows
            _characterWindow = new Windows.CharacterViewer();
        }
Пример #9
0
        private static void Init()
        {
            // Any setup
            if (Settings.UnlimitedFPS)
            {
                SadConsole.Game.Instance.Components.Add(new SadConsole.Game.FPSCounterComponent(SadConsole.Game.Instance));
            }

            // Setup our custom theme.
            Theme.SetupThemes();

            SadConsole.Game.Instance.Window.Title = "DemoProject FNA";


            // We'll instead use our demo consoles that show various features of SadConsole.
            MainConsole          = new Container();
            Global.CurrentScreen = MainConsole;

            // Initialize the windows
            _characterWindow = new Windows.CharacterViewer();
        }
Пример #10
0
        private static void Init()
        {
            // Any setup
            if (Settings.UnlimitedFPS)
            {
                SadConsole.Game.Instance.Components.Add(new SadConsole.Game.FPSCounterComponent(SadConsole.Game.Instance));
            }


            // Setup our custom theme.
            StarterProject.Theme.SetupThemes();

            // By default SadConsole adds a blank ready-to-go console to the rendering system.
            // We don't want to use that for the sample project so we'll remove it.

            //Global.MouseState.ProcessMouseWhenOffScreen = true;

            // We'll instead use our demo consoles that show various features of SadConsole.
            Global.CurrentScreen.Children.Add(new CustomConsoles.RandomScrollingConsole());
            Global.CurrentScreen.Children.Add(new CustomConsoles.AutoTypingConsole());
            Global.CurrentScreen.Children.Add(new CustomConsoles.StringParsingConsole());
            Global.CurrentScreen.Children.Add(new CustomConsoles.ControlsTest());
            //Global.CurrentScreen.Children.Add(new CustomConsoles.AnsiConsole()); //Code to load ansi files is not platform independent yet.
            Global.CurrentScreen.Children.Add(new CustomConsoles.StretchedConsole());
            Global.CurrentScreen.Children.Add(new CustomConsoles.SubConsoleCursor());
            Global.CurrentScreen.Children.Add(new CustomConsoles.CursorConsole());
            Global.CurrentScreen.Children.Add(new CustomConsoles.ViewsAndSubViews());
            Global.CurrentScreen.Children.Add(new CustomConsoles.GameObjectConsole());
            Global.CurrentScreen.Children.Add(new CustomConsoles.DOSConsole());
            Global.CurrentScreen.Children.Add(new CustomConsoles.BorderedConsole());
            Global.CurrentScreen.Children.Add(new CustomConsoles.ScrollableConsole(25, 6, 70));

            // Not working... it was...
            Global.CurrentScreen.Children.Add(new CustomConsoles.SceneProjectionConsole());

            //= new ConsoleList() {
            //    //new CustomConsoles.CachedConsoleConsole(),
            //                        //new CustomConsoles.RandomScrollingConsole(),
            //                        new CustomConsoles.AutoTypingConsole(),
            //                        //new CustomConsoles.SplashScreen() { SplashCompleted = () => { MoveNextConsole(); } },
            //                        new CustomConsoles.StretchedConsole(),
            //                        new CustomConsoles.StringParsingConsole(),
            //                        new CustomConsoles.ControlsTest(),
            //                        //new CustomConsoles.FadingExample(),
            //                        new CustomConsoles.DOSConsole(),
            //                        new CustomConsoles.AnsiConsole(),
            //                        new CustomConsoles.ViewsAndSubViews(),
            //                        new CustomConsoles.StaticConsole(),
            //                        new CustomConsoles.SceneProjectionConsole(),
            //                        new CustomConsoles.BorderedConsole(),
            //                        new CustomConsoles.GameObjectConsole(),
            //                        new CustomConsoles.WorldGenerationConsole(),
            //                    };

            // Show the first console (by default all of our demo consoles are hidden)
            Global.CurrentScreen.Children[0].IsVisible = true;

            // Set the first console in the console list as the "active" console. This allows the keyboard to be processed on the console.
            Console.ActiveConsole = (IConsole)Global.CurrentScreen.Children[0];

            // Initialize the windows
            _characterWindow = new Windows.CharacterViewer();

            //SadConsole.Effects.Fade a = new SadConsole.Effects.Fade();
            //a.DestinationForeground = Microsoft.Xna.Framework.Color.Turquoise;
            //SadConsole.Engine.MonoGameInstance.Components.Add(new FPSCounterComponent(SadConsole.Engine.MonoGameInstance));
        }