Пример #1
0
        public void CreateMapWindow(int width, int height, string title)
        {
            SadConsole.Themes.WindowTheme windowTheme = new SadConsole.Themes.WindowTheme();
            SadConsole.Themes.Library.Default.WindowTheme            = windowTheme;
            SadConsole.Themes.Library.Default.Colors.TitleText       = Color.White;
            SadConsole.Themes.Library.Default.Colors.Lines           = Color.Black;
            SadConsole.Themes.Library.Default.Colors.ControlHostBack = Color.Transparent;

            MapWindow = new Window(width, height, SadConsole.Global.FontEmbedded);
            var size = new Point(MapWindow.Width, MapWindow.Height).TranslateFont(MapWindow.Font, MapConsole.Font);

            MapWindow.CanDrag   = true;
            HealthBars          = new SadConsole.ScrollingConsole(80, height, SadConsole.Global.FontEmbedded);
            HealthBars.ViewPort = new Microsoft.Xna.Framework.Rectangle(width, 0, size.X * 2, size.Y);
            HealthBars.Position = new Point(width, 1);

            int mapConsoleWidth = width - 2;

            MapConsole.ViewPort = new Microsoft.Xna.Framework.Rectangle(0, 0, size.X, size.Y);
            MapConsole.Position = new Point(1, 1);

            MapWindow.Title = title.Align(HorizontalAlignment.Center, mapConsoleWidth);
            MapWindow.Children.Add(HealthBars);
            MapWindow.Children.Add(MapConsole);
            Children.Add(MapWindow);
            MapWindow.Show();
        }
Пример #2
0
        private static void Init()
        {
            SadConsole.Themes.WindowTheme windowTheme = new SadConsole.Themes.WindowTheme(new SadConsole.Themes.Colors());
            windowTheme.BorderLineStyle = CellSurface.ConnectedLineThick;
            SadConsole.Themes.Library.Default.WindowTheme = windowTheme;

            string[] allFiles = Directory.GetFiles(@"./fonts/");

            for (int i = 0; i < allFiles.Length; i++)
            {
                if (allFiles[i].Contains(".font"))
                {
                    Global.LoadFont(allFiles[i]);
                }
            }

            RegularSize   = Global.Fonts["Cheepicus48"].GetFont(Font.FontSizes.Quarter);
            DoubleSize    = Global.Fonts["Cheepicus48"].GetFont(Font.FontSizes.Half);
            QuadrupleSize = Global.Fonts["Cheepicus48"].GetFont(Font.FontSizes.One);

            MapQuarter = Global.Fonts["Cheepicus48"].GetFont(Font.FontSizes.Quarter);
            MapHalf    = Global.Fonts["Cheepicus48"].GetFont(Font.FontSizes.Half);
            MapOne     = Global.Fonts["Cheepicus48"].GetFont(Font.FontSizes.One);



            SadConsole.Themes.Library.Default.Colors.TitleText       = CyberBlue;
            SadConsole.Themes.Library.Default.Colors.Lines           = CyberBlue;
            SadConsole.Themes.Library.Default.Colors.ControlHostBack = Color.Black;


            //SadConsole.Themes.Library.Default.Colors.Appearance_ControlNormal = new Cell();
            //SadConsole.Themes.Library.Default.Colors.Appearance_ControlOver = new Cell(Color.Blue, Color.Black);
            //SadConsole.Themes.Library.Default.Colors.Appearance_ControlMouseDown = new Cell(Color.DarkBlue, Color.Black);
            //SadConsole.Themes.Library.Default.Colors.Appearance_ControlFocused = new Cell(Color.White, Color.Black);

            Utils.InitDirections();

            Global.FontDefault = RegularSize;
            Global.FontDefault.ResizeGraphicsDeviceManager(SadConsole.Global.GraphicsDeviceManager, 80, 60, 0, 0);
            Global.ResetRendering();



            Global.KeyboardState.InitialRepeatDelay = 0.5f;

            Settings.AllowWindowResize = true;

            UIManager = new UIManager();

            initLibraries();

            CommandManager = new CommandManager();

            NetworkingManager = new NetworkingManager();
            TimeManager       = new TimeManager();

            World = new World("");

            UIManager.Init();
            SadConsole.Game.Instance.Window.ClientSizeChanged += Window_ClientSizeChanged;

            SadConsole.Game.OnUpdate += postUpdate;



            SimplexNoise.Noise.Seed = 2;
            List <float> points = new List <float>();

            for (int i = 0; i < 200; i++)
            {
                points.Add(SimplexNoise.Noise.CalcPixel2D(i - 10, 0, 0.5f));
            }
        }