예제 #1
0
        private void spritesheetPBox_DragDrop(object sender, DragEventArgs e)
        {
            foreach (string pic in ((string[])e.Data.GetData(DataFormats.FileDrop)))
            {
                Image img = Image.FromFile(pic);
                spritesheetPBox.Image = img;
                Spritesheet           = new Spritesheet(pic);
            }

            spritesheetArea = new Bitmap(Spritesheet.Width, Spritesheet.Height);
            drawGrid();
        }
예제 #2
0
        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);
                    spritesheetArea = new Bitmap(Spritesheet.Width, Spritesheet.Height);
                    drawGrid();
                }
            }
        }
예제 #3
0
        public Spritesheet GetSpritesheet()
        {
            Spritesheet spritesheet = new Spritesheet();

            // find the first tile details
            for (int i = 0; i < map.Length; i++)
            {
                if (map[i] != null)
                {
                    spritesheet = map[i].Spritesheet;
                    break;
                }
            }

            return(spritesheet);
        }
예제 #4
0
        public void LoadFromFile(string path)
        {
            // load the level
            level = Level.LoadFromFile(path);

            // we need to first set the spritesheet canvas area and for now, just file the first tile
            // and use the spritesheet path. The assumption is we can only save a file if there is
            // at last one tile drawn.
            // load the spritesheet into spritesheet picture box
            //Spritesheet = new Spritesheet(level.GetSpritesheet().Path);
            Spritesheet = new Spritesheet(Path.GetDirectoryName(path) + "\\" + level.GetSpritesheet().Path);

            spritesheetArea = new Bitmap(Spritesheet.Width, Spritesheet.Height);
            drawGrid();

            // draw the canvas
            DrawTiles();

            // populate the grid details
            textBoxWidth.Text   = level.GridWidth.ToString();
            textBoxHeight.Text  = level.GridHeight.ToString();
            textBoxSpacing.Text = level.GridSpacing.ToString();
        }
예제 #5
0
 public TileInfo(Point index, Spritesheet spritesheet)
 {
     Index       = index;
     Spritesheet = spritesheet;
 }