Beispiel #1
0
        private void openTilesetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog file = new OpenFileDialog();

            file.InitialDirectory = "../Tilesets";
            file.Filter = "Image files (*.img *.jpg *.png *.bmp)|*.img; *.jpg; *.png; *.bmp|All Files (*.*)| *.*";
            file.Title = "Load tiles";

            if (file.ShowDialog() == DialogResult.OK)
            {
                TileSetImagepath = file.FileName;

                //Texture Texture2D

                FileStream stream = new FileStream(TileSetImagepath, FileMode.Open);
                tilemaptexture = Texture2D.FromStream(GraphicsDevice, stream);

                stream.Close();
                stream.Dispose();

                tileset = new Tileset(tilemaptexture);

                //Image inladen in panel / palette
                tilepalette = new TilePalette(this);
                PnlPaletteContainer.Controls.Add(tilepalette);
                tilepalette.SetImage(TileSetImagepath);

            }
        }
Beispiel #2
0
        private void loadtileset()
        {
            TileSetImagepath = "./Tilesets/StandardTileSet.png";
                FileStream stream = new FileStream(TileSetImagepath, FileMode.Open);
            tilemaptexture = Texture2D.FromStream(GraphicsDevice, stream);
            stream.Close();
            stream.Dispose();
            tileset = new Tileset(tilemaptexture);

            //Image inladen in panel / palette
            tilepalette = new TilePalette(this);
            PnlPaletteContainer.Controls.Add(tilepalette);
            tilepalette.SetImage(TileSetImagepath);
        }