Example #1
0
 public AddCollision(List <SingularSprite> frames, SingularSprite currentFrame)
 {
     this.frames       = frames;
     this.currentFrame = currentFrame;
     InitializeComponent();
     UpdateButtonStates();
 }
Example #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     //add image to list
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         try
         {
             foreach (String file in openFileDialog1.FileNames)
             {
                 SingularSprite ss = new SingularSprite()
                 {
                     image     = (Bitmap)Image.FromFile(file),
                     imagePath = file
                 };
                 string name = file.Split('\\')[file.Split('\\').Length - 1];
                 ss.name = name;
                 listBox1.Items.Add(name);
                 loadedSprites.Add(ss);
                 selectedSprite = ss;
                 LoadInformation();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
         }
     }
 }
Example #3
0
        private void button6_Click(object sender, EventArgs e)
        {
            //forwards one image
            int idx = frames.IndexOf(currentFrame);

            frames[frames.IndexOf(currentFrame)].colisions = boxes;
            boxes.Clear();
            currentFrame = frames[idx + 1];
            UpdateButtonStates();
            LoadSingularSprite(currentFrame);
        }
Example #4
0
        private void LoadSingularSprite(SingularSprite sp)
        {
            if (sp.colisions.Count > 0)
            {
                boxes = sp.colisions;
            }
            Bitmap image = sp.image;

            loaded                 = image;
            pictureBox1.Image      = image;
            trackBar1.Maximum      = image.Width - 1;
            trackBar2.Maximum      = image.Width - 1;
            trackBar3.Maximum      = image.Height - 1;
            trackBar4.Maximum      = image.Height - 1;
            trackBar3.Value        = image.Height - 1;
            trackBar4.Value        = image.Height - 1;
            numericUpDown1.Maximum = image.Width - 1;
            numericUpDown2.Maximum = image.Height - 1;
            numericUpDown4.Maximum = image.Width - 1;
            numericUpDown3.Maximum = image.Height - 1;

            if (sp.colisions.Count > 0)
            {
                foreach (ColisionBox cb in sp.colisions.ToList())
                {
                    boxes.Add(cb);
                }
                currentlyIndexed = sp.colisions[0];
            }
            else
            {
                ColisionBox add = new ColisionBox();
                add.type = curBox == 0 ? 2 : 1;
                boxes.Add(add);
                currentlyIndexed = add;
            }
            textBox1.Text        = sp.imagePath;
            numericUpDown2.Value = currentlyIndexed.topY;
            numericUpDown3.Value = currentlyIndexed.botY;
            numericUpDown1.Value = currentlyIndexed.topX;
            numericUpDown4.Value = currentlyIndexed.botX;
        }
Example #5
0
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     selectedSprite = loadedSprites[listBox1.SelectedIndex];
     LoadInformation();
 }