Ejemplo n.º 1
0
        private void LoadSpriteDropdown()
        {
            linkSpriteCombobox.Items.Add(new files_names("Unchanged", "Unchanged"));
            linkSpriteCombobox.Items.Add(new files_names("Random", "Random"));
            linkSpriteCombobox.SelectedIndex = 0;

            foreach (string f in Directory.GetFiles("sprites\\"))
            {
                try
                {
                    var         s    = new EnemizerLibrary.Sprite(File.ReadAllBytes(f));
                    files_names item = new files_names(String.IsNullOrEmpty(s.DisplayText) ? Path.GetFileNameWithoutExtension(f) : s.DisplayText, f);
                    linkSpriteCombobox.Items.Add(item);
                }
                catch { } // skip the bad sprite
            }
        }
Ejemplo n.º 2
0
        private void linkSpriteCombobox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (linkSpriteCombobox.SelectedIndex > 1)
            {
                try
                {
                    var s = new EnemizerLibrary.Sprite(File.ReadAllBytes((linkSpriteCombobox.Items[linkSpriteCombobox.SelectedIndex] as files_names).file.ToString()));

                    Sprite linkSprite = new Sprite();
                    linkSpritePicturebox.Image = linkSprite.refreshEverything(linkSpritePicturebox.BackColor, linkSpritePicturebox.Image, s.PixelData, s.PaletteData);
                    linkSpritePicturebox.Refresh();
                }
                catch { }
                //FileStream fs = new FileStream((linkSpriteCombobox.Items[linkSpriteCombobox.SelectedIndex] as files_names).file.ToString(), FileMode.Open, FileAccess.Read);
                //var data = new byte[fs.Length];
                //fs.Read(data, 0, (int)fs.Length);
                //fs.Close();

                //Sprite linkSprite = new Sprite();
                //linkSpritePicturebox.Image = linkSprite.refreshEverything(linkSpritePicturebox.BackColor, linkSpritePicturebox.Image, data);
                //linkSpritePicturebox.Refresh();
            }
        }