Ejemplo n.º 1
0
        private void CreateSpriteControl(ArtSprite sprite)
        {
            SpriteControl newSpriteControl = new SpriteControl();

            newSpriteControl.OnSpriteSelected += SpriteSelectedHandler;
            newSpriteControl.Sprite            = sprite;
            panelSprites.Controls.Add(newSpriteControl);
        }
Ejemplo n.º 2
0
        public void AddSprite(string name, int width, int height)
        {
            ArtSprite newSprite;

            newSprite = new ArtSprite(name, width, height);
            _file.Sprites.Add(newSprite);
            CreateSpriteControl(newSprite);
            ((SpriteControl)panelSprites.Controls[panelSprites.Controls.Count - 1]).Selected = true;
        }
Ejemplo n.º 3
0
        public ArtSprite Duplicate()
        {
            ArtSprite rc;

            rc = new ArtSprite(
                string.Format("{0}_copy", _name),
                _width,
                _height);
            rc._note = _note;
            rc._data = (BitArray)_data.Clone();
            //for (int x = 0; x < 128; x++)
            //    for (int y = 0; y < 64; y++)
            //        rc._data[x, y] = _data[x, y];
            return(rc);
        }
Ejemplo n.º 4
0
        private void btOK_Click(object sender, EventArgs e)
        {
            bool isValid = true;

            myErrors.Clear();

            if (_source == null)
            {
                myErrors.SetError(panelPreview, Properties.Resources.ERR_EMPTY);
                isValid = false;
            }

            if (txtName.Text.Length == 0)
            {
                myErrors.SetError(txtName, Properties.Resources.ERR_EMPTY);
                isValid = false;
            }

            if (isValid)
            {
                _sprite = new ArtSprite(
                    txtName.Text,
                    (int)txtWidth.Value,
                    (int)txtHeight.Value);
                for (int x = 0; x < (int)txtWidth.Value; x++)
                {
                    for (int y = 0; y < (int)txtHeight.Value; y++)
                    {
                        Color c = _preview.GetPixel(x, y);
                        _sprite.SetPixel(x, y, (c.R == 255), false);
                    }
                }

                DialogResult = DialogResult.OK;
            }
        }
 public OnSpriteSelectedEventArgs(ArtSprite sprite)
 {
     _position = -1;
     _sprite   = sprite;
 }
 public OnSpriteSelectedEventArgs(int position, ArtSprite sprite)
 {
     _position = position;
     _sprite   = sprite;
 }
Ejemplo n.º 7
0
 public void AddSprite(ArtSprite newSprite)
 {
     _file.Sprites.Add(newSprite);
     CreateSpriteControl(newSprite);
     ((SpriteControl)panelSprites.Controls[panelSprites.Controls.Count - 1]).Selected = true;
 }