public void ChangeTileset(TilesetEditor tileset)
        {
            if (tileset == this.tileset) return;

            this.tileset = tileset;
            selected = 0;
            currentFrame = 0;

            if (image != null) image.Dispose();
            comboProperties.Items.Clear();

            if (tileset != null)
            {
                image = new Bitmap(tileset.TileSize, tileset.TileSize);
                image.SetResolution(tileset.Sheet.HorizontalResolution, tileset.Sheet.VerticalResolution);
                picture.Image = image;
                picture.Size = image.Size;

                FillPropertyList();

                tilePanel.MinimumSize = new Size(tileset.TileSize, tileset.TileSize);

                CenterImage();
            }

            ReDraw();
        }
        public Toolbox(Form owner, TilesetEditor tileset)
        {
            InitializeComponent();

            this.MdiParent = owner;

            ChangeTileset(tileset);
        }
        public TileListForm(Form owner, TilesetEditor tileset)
            : this()
        {
            selectedPen = new Pen(Brushes.Lime, 2);
            hotPen = new Pen(Brushes.Orange, 2);

            hot = selected = 0;

            this.MdiParent = owner;

            ChangeTileset(tileset);

            Program.FrameTick += new Action(Program_FrameTick);

            Animate = true;
        }
        public TilePropForm(TilesetEditor editor, TileProperties properties)
        {
            InitializeComponent();

            this.Tileset = editor;
            this.Properties = properties;
            name.Text = properties.Name;
            checkBlocking.Checked = properties.Blocking;
            checkLethal.Checked = properties.Lethal;
            checkClimb.Checked = properties.Climbable;
            resistX.Value = (decimal)properties.ResistX;
            resistY.Value = (decimal)properties.ResistY;
            pushX.Value = (decimal)properties.PushX;
            pushY.Value = (decimal)properties.PushY;
            dragX.Value = (decimal)properties.DragX;
            dragY.Value = (decimal)properties.DragY;

            Tileset.Closed += (e) => this.Close();
        }
        public void ChangeTileset(TilesetEditor tileset)
        {
            if (this.tileset != null)
            {
                this.tileset.TileAdded -= tileset_TileAdded;
            }

            this.tileset = tileset;

            AdjustLayout(true);

            if (tileset != null)
            {
                tileset.TileAdded += tileset_TileAdded;

                if (Animate) tileset.Play();
                else tileset.Stop();
            }
        }
Exemple #6
0
        private void LoadTilesetForms(TilesetEditor tiles)
        {
            if (tiles == null) return;

            if (listForm == null)
            {
                listForm = new TileListForm(this, tiles);
                listForm.Show();
                listForm.Top = 10;
                listForm.Left = 10;
                listForm.SelectedChanged += new Action<int>(listForm_SelectedChanged);
            }

            if (toolboxForm == null)
            {
                toolboxForm = new Toolbox(this, tiles);
                toolboxForm.Show();
                toolboxForm.Top = 120;
                toolboxForm.Left = 350;
            }

            var sheet = new TileSheetForm(this, tiles);
            sheet.Show();
            sheet.Top = 120;
            sheet.Left = 10;
            sheet.SheetClicked += new Action<Point>(sheetForm_SheetClicked);
            sheet.GotFocus += new EventHandler(sheet_GotFocus);

            if (!string.IsNullOrEmpty(tiles.FilePath))
            {
                savedSheets.Add(tiles.FilePath, sheet);
            }
            tiles.Closed += new Action<TilesetEditor>(tiles_Closed);

            ChangeSheet(sheet);

            tiles.PathChanged += new Action<string, string>(tiles_PathChanged);
        }
        public TileSheetForm(Form1 owner, TilesetEditor tileset)
        {
            InitializeComponent();

            this.owner = owner;
            this.MdiParent = owner;

            this.Tileset = tileset;
            tileSheetImage = new Bitmap(tileset.Sheet.Width, tileset.Sheet.Height);
            tileSheetImage.SetResolution(tileset.Sheet.HorizontalResolution, tileset.Sheet.VerticalResolution);
            tileSheetPicture.Image = tileSheetImage;
            tileSheetPicture.Size = tileset.Sheet.Size;

            this.Text = tileset.Name;

            tileset.DirtyChanged += new Action<bool>(tileset_DirtyChanged);

            CenterImage();

            highlightPen = new Pen(Brushes.Green);

            ReDraw();
        }
Exemple #8
0
 void tiles_Closed(TilesetEditor obj)
 {
     if (obj.FilePath != null) savedSheets.Remove(obj.FilePath);
     toolboxForm.ChangeTileset(null);
     listForm.ChangeTileset(null);
 }
        public static TilesetEditor CreateNew(string imagePath, int tileSize)
        {
            Image sheet = Image.FromFile(imagePath);

            Tileset tileset = new Tileset(sheet, tileSize);
            tileset.SheetPathAbs = imagePath;
            TilesetEditor editor = new TilesetEditor(tileset);
            editor.Dirty = true;
            return editor;
        }