예제 #1
0
파일: Form1.cs 프로젝트: R3coil/RTS_XNA_v2
        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);

            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: Wotuu/RTS_XNA_v2
        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);
        }