public SpriteSheetForm(Spritesheet spritesheet) { InitializeComponent(); Spritesheet = spritesheet; drawArea = new Bitmap(pictureBox1.Width, pictureBox1.Height); drawGrid(); }
private void buttonLoad_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); if (dlg.ShowDialog() == DialogResult.OK) { if (dlg.CheckFileExists == true) { Spritesheet = new Spritesheet(dlg.FileName); drawGrid(); } } }
static void Main(string[] args) { string path; string name; Console.WriteLine("Working directory is " + Directory.GetCurrentDirectory()); Console.WriteLine("Enter the relative path of the sprite sheet texture: "); path = Console.ReadLine(); Console.WriteLine("Make a new character (y/n): "); while (Console.ReadLine().ToLower().StartsWith("y") == true) { Console.WriteLine("Enter the name of the character to create: "); name = Console.ReadLine(); spritesheet = new Spritesheet(Directory.GetCurrentDirectory() + "\\" + path); if (spritesheet == null) { Console.WriteLine("Error loading sprite sheet. Exiting program."); return; } Character character = new Character(name, spritesheet); Console.WriteLine("Enter the x tile index: "); int x = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the y tile index: "); int y = int.Parse(Console.ReadLine()); Layer layer = new Layer("base", new System.Drawing.Point(x, y)); character.AddLayer(layer); Console.WriteLine(character.ToString()); characters.Add(character); Console.WriteLine("Make a new character (y/n): "); } Console.Clear(); foreach (Character character in characters) { Console.WriteLine(character.ToString()); } Console.ReadKey(); }
static void Main(string[] args) { WriteLine("Working directory is " + Directory.GetCurrentDirectory()); WriteLine("Enter the relative path of the sprite sheet texture: "); var path = ReadLine(); Console.WriteLine("Make a new character (y/n): "); while (Console.ReadLine().ToLower().StartsWith("y") == true) { WriteLine("Enter the name of the character to create: "); var name = ReadLine(); spritesheet = new Spritesheet(Directory.GetCurrentDirectory() + "\\" + path); if (spritesheet == null) { WriteLine("Error loading sprite sheet. Exiting program."); return; } character = new Character(name, spritesheet); WriteLine("Enter the x tile index: "); var x = int.Parse(ReadLine()); Console.WriteLine("Enter the y tile index: "); var y = int.Parse(ReadLine()); character.tileCoordinates = new System.Drawing.Point(x, y); characters.Add(character); Console.WriteLine("Make a new character (y/n): "); } Console.Clear(); foreach (Character character in characters) { Console.WriteLine(character.ToString()); } var containerStuff = new Container_stuff(); containerStuff.ArrayExample(5); ReadKey(); }
private void SpriteForm_Activated(object sender, EventArgs e) { MdiClient parent = Parent as MdiClient; if (parent != null) { foreach (Form child in parent.MdiChildren) { if (child.GetType() == typeof(SpriteSheetForm)) { SpriteSheetForm sheet = child as SpriteSheetForm; Spritesheet ss = sheet.Spritesheet; if (ss != null && !comboBoxSheets.Items.Contains(ss)) { comboBoxSheets.Items.Add(ss); } } } } if (character.Spritesheet != null) { comboBoxSheets.SelectedItem = character.Spritesheet; } else if (comboBoxSheets.Items.Count > 0) { comboBoxSheets.SelectedIndex = 0; character.Spritesheet = comboBoxSheets.SelectedItem as Spritesheet; } // fill list view with any layers the character has listViewTiles.Items.Clear(); for (int i = 0; i < character.Layers.Count; i++) { listViewTiles.Items.Add(character.Layers[i].GetListViewItem()); } }
public Character(string name, Spritesheet spritesheet) { this.name = name; this.spritesheet = spritesheet; }
public override string ToString() { return(base.ToString() + "\n\tpath: \t" + Spritesheet.ToString() + "\n\ttile coordinates: \t" + layers[0].TileCoordinates.ToString()); }