private static void Init() { // Any custom loading and prep. We will use a sample console for now Console startingConsole = new Console(Width, Height); FontMaster fontMaster = SadConsole.Global.LoadFont("cp437.font"); startingConsole.TextSurface.Font = fontMaster.GetFont(SadConsole.Font.FontSizes.One); SadRex.Image tempImage = SadRex.Image.Load(TitleContainer.OpenStream("temp.xp")); //tempImage.Layers[0].Cells[0].Background and Character SadRex.Layer imageLayer = tempImage.Layers[0]; for (int yPos = 0; yPos < tempImage.Height; yPos++) { for (int xPos = 0; xPos < tempImage.Width; xPos++) { //2-D to 1-D coordinate: (yPos*Width) + xPos SadRex.Cell currentCell = imageLayer.Cells[(yPos * Width) + xPos]; startingConsole.SetGlyph(xPos, yPos, currentCell.Character, new Color( currentCell.Foreground.R, currentCell.Foreground.G, currentCell.Foreground.B), new Color(currentCell.Background.R, currentCell.Background.G, currentCell.Background.B)); } } /* * startingConsole.FillWithRandomGarbage(); * startingConsole.Fill(new Rectangle(3, 3, 27, 5), null, Color.Black, 0); * startingConsole.Print(6, 5, "Hello from SadConsole", ColorAnsi.CyanBright);//*/ // Set our new console as the thing to render and process SadConsole.Global.CurrentScreen = startingConsole; }
private static void Init() { System.Console.WriteLine( @"Shattered World - Of Cybertech and Magitech Copyright(C) 2019 PurpleSharkBooks This program is free software: you can redistribute it and / or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see < http://www.gnu.org/licenses/>."); FileLoader = new Utils.FileLoader(); GameSettings = FileLoader.LoadSettings(); SadConsole.Game.Instance.Window.IsBorderless = false; fontMaster = SadConsole.Global.LoadFont("./GameData/Assets/Fonts/Cheepicus12.font"); Global.FontDefault = fontMaster.GetFont(Font.FontSizes.One); GetSystemInfo(); //System.Console.WriteLine($"{SadConsole.Game.Instance.Window.IsBorderless}"); Data.Entities.Traits = FileLoader.LoadComponents(); Settings.ResizeMode = Settings.WindowResizeOptions.None; GameView = new UserInterface(ScreenWidth, ScreenHeight, MapWidth, MapHeight); GameView.Font = fontMaster.GetFont(Font.FontSizes.One); Global.CurrentScreen.Font = fontMaster.GetFont(Font.FontSizes.One); Global.CurrentScreen.Resize(110, 55, false); Global.CurrentScreen = GameView; }
private static void Init() { //CreatePresetThemes(); // Load a double sized font FontMaster fontMaster = SadConsole.Global.LoadFont("cp437_10_ext.font"); Global.FontDefault = fontMaster.GetFont(Font.FontSizes.Two); Random = new Random(); // Create TetrisWindow = new TetrisWindow(); SnakeWindow = new SnakeWindow(); WindowTheme Editor = new WindowTheme(); Editor.FillStyle = new Cell(Color.Transparent, Color.Black, 219); Library.Default.WindowTheme = Editor; ThemeEditor = new ThemeEditorWindow(80, 40); TilesetViewer = new TilesetViewer(); MapView = new MapView(); MainMenu = new MainMenu(80, 40); MainMenu.Show(); }
public UIBuilder(Size gameSize, FontMaster mapFontMaster, ILog logger) { GameSize = gameSize; MapFontMaster = mapFontMaster; MapFont = MapFontMaster.GetFont(Font.FontSizes.One); log = logger; }
public MapView( ) : base(59, 39) { Title = "Map"; FontMaster fontMaster = SadConsole.Global.LoadFont("Kein5x5.font"); BattleMap = MapLoader.Load("WinterWar/Maps/0/"); Children.Add(BattleMap); Children.Add(BattleMap.TileInfo); BattleMap.Position = new Point(2, 2); BattleMap.ViewPort = new Microsoft.Xna.Framework.Rectangle(0, 0, (Width - 2) * ZoomLevel, (Height - 2) * ZoomLevel); BattleMap.MouseOverNewCell += HandleMouseCellChanged; _targetLine = new TargettingLine(BattleMap); BattleMap.UpdateFov(); }
private static void Init() { // Load the fonts _kenneyFont = Global.LoadFont("Fonts/Kenney/Kenney.font"); _kenneyFontCharacters = Global.LoadFont("Fonts/Kenney/KenneyCharacters.font"); _cheepicusFont = Global.LoadFont("Fonts/DwarfFortress/Cheepicus.font"); _console = new Console(Width, Height, _kenneyFont.GetFont(Font.FontSizes.One)); _uiConsole = new Console(Width, Height, _cheepicusFont.GetFont(Font.FontSizes.One)); _uiConsole.Parent = _console; // Any startup code for your game. We will use an example console for now _uiConsole.FillWithRandomGarbage(); _uiConsole.Fill(new Rectangle(3, 3, 27, 5), null, Color.Black, 0, SpriteEffects.None); _uiConsole.Print(6, 5, "Hello from SadConsole", ColorAnsi.CyanBright); Global.CurrentScreen = _console; }
public BattleMap(int width, int height) : base(width, height) { EntityManager = new EntityManager(); Children.Add(EntityManager); FontMaster fontMaster = SadConsole.Global.LoadFont("Kein5x5.font"); EntityFactory.EntityFont = fontMaster.GetFont(Font.FontSizes.Two); Font = fontMaster.GetFont(Font.FontSizes.Two); Tiles = new WWTile[width * height]; for (int i = 0; i < Tiles.Length; i++) { Tiles[i] = new WWTile( ); Tiles[i].Position = new Point(i % Width, i / Width); Tiles[i].TileChanged += BattleMap_TileChanged; } TileInfo = new Console(40, 1) { Font = SadConsole.Global.FontDefault.Master.GetFont(Font.FontSizes.One), Position = new Point(2, 2), DefaultForeground = Color.Black, DefaultBackground = Color.Transparent, }; Global.FocusedConsoles.Push(this); CreateTrooper(31, 13, true); CreateTrooper(42, 28, true); CreateTrooper(54, 48, true); CreateTrooper(80, 45, false); CreateTrooper(85, 50, false); CreateTrooper(83, 91, true); CreateTrooper(80, 40, false); GetNextPlayerUnit(); }
public void LoadTileset(string path, int tileWidth = 16, int tileHeight = 8) { FontMaster fontMaster = SadConsole.Global.LoadFont("unscii_16_ext.font"); fontMaster.Columns = 64; //fontMaster.Rows = 35; TilesetConsole = new Console(64, 70); TilesetConsole.Font = fontMaster.GetFont(Font.FontSizes.Two); TilesetConsole.ViewPort = new Rectangle(0, 0, Width, Height); Children.Add(TilesetConsole); for (int x = 0; x < fontMaster.Columns; x++) { for (int y = 0; y < fontMaster.Rows; y++) { int index = GetIndexFromPoint(x, y); TilesetConsole.Cells[index].Glyph = index; } } }
public MainMenu(int Width, int Height) : base(Width, Height) { FontMaster fontMaster = SadConsole.Global.LoadFont("cp437_10_ext.font"); Font titleFont = fontMaster.GetFont(Font.FontSizes.Four); Basic title = new SadConsole.Surfaces.Basic(20, 1); title.Font = titleFont; title.Position = new Point(Width / 4 - "Main Menu".Length / 2, 2); title.Print(0, 0, "Main Menu"); Children.Add(title); var tetrisButton = new SadConsole.Controls.Button(11, 3); tetrisButton.Text = "Tetris"; tetrisButton.TextAlignment = HorizontalAlignment.Center; tetrisButton.Position = new Point(Width / 2 - tetrisButton.Width / 2, 10); tetrisButton.Theme = new SadConsole.Themes.ButtonLinesTheme(); Add(tetrisButton); tetrisButton.Click += (btn, args) => { Program.MainMenu.Hide(); Program.TetrisWindow.Show(); }; var snakeButton = new SadConsole.Controls.Button(11, 3); snakeButton.Position = new Point(Width / 2 - snakeButton.Width / 2, 14); snakeButton.TextAlignment = HorizontalAlignment.Center; snakeButton.Text = "Snake"; snakeButton.Theme = new SadConsole.Themes.ButtonLinesTheme(); Add(snakeButton); snakeButton.Click += (btn, args) => { Program.MainMenu.Hide(); Program.SnakeWindow.Show(); }; var themeButton = new SadConsole.Controls.Button(11, 3); themeButton.Position = new Point(Width / 2 - snakeButton.Width / 2, 18); themeButton.TextAlignment = HorizontalAlignment.Center; themeButton.Text = "Theme"; themeButton.Theme = new SadConsole.Themes.ButtonLinesTheme(); Add(themeButton); themeButton.Click += (btn, args) => { Program.MainMenu.Hide(); Program.ThemeEditor.Show(); }; var viewerButton = new SadConsole.Controls.Button(11, 3); viewerButton.Position = new Point(Width / 2 - snakeButton.Width / 2, 22); viewerButton.TextAlignment = HorizontalAlignment.Center; viewerButton.Text = "Viewer"; viewerButton.Theme = new SadConsole.Themes.ButtonLinesTheme(); Add(viewerButton); viewerButton.Click += (btn, args) => { Program.MainMenu.Hide(); Program.TilesetViewer.Show(); }; var mapViewButton = new SadConsole.Controls.Button(11, 3); mapViewButton.Position = new Point(Width / 2 - snakeButton.Width / 2, 26); mapViewButton.TextAlignment = HorizontalAlignment.Center; mapViewButton.Text = "MapView"; mapViewButton.Theme = new SadConsole.Themes.ButtonLinesTheme(); Add(mapViewButton); mapViewButton.Click += (btn, args) => { Program.MainMenu.Hide(); //Children.Add( Program.MapView ); //Global.CurrentScreen = Program.MapView; Program.MapView.Show(); Global.FocusedConsoles.Set(Program.MapView); }; var themeRadioButton = new RadioButton(10, 1); themeRadioButton.Text = "Light"; themeRadioButton.Position = new Point(60, 2); themeRadioButton.GroupName = "Theme"; Add(themeRadioButton); themeRadioButton.IsSelectedChanged += OnThemeRadioChanged; themeRadioButton = new RadioButton(10, 1); themeRadioButton.Text = "Dark"; themeRadioButton.Position = new Point(60, 4); themeRadioButton.GroupName = "Theme"; Add(themeRadioButton); themeRadioButton.IsSelectedChanged += OnThemeRadioChanged; }
public SadConEntityFactory(FontMaster mapFontMaster) { MapFontMaster = mapFontMaster; MapFont = MapFontMaster.GetFont(Font.FontSizes.One); }