public void LoadTileset(Texture2D texture) { Tileset = new Tileset("splittertileset", EditorEngine.Instance.World.TilesetFactory); Tileset.Texture = new TileableTexture(texture); int xt = texture.Width >> 4; int yt = texture.Height >> 4; hscrollbar.Maximum = xt << 4; vscrollbar.Maximum = yt << 4; Tileset.Texture.Columns = texture.Width >> 4; Tileset.Texture.Rows = texture.Height >> 4; Tileset.GenerateTiles(); Random rand = new Random(); //Reset points for (int i = 0; i < points.Length; i++) { points[i].Clear(); } //Scramble colors ScrambleColors(); }
public override void LoadContent() { batch = new SpriteBatch(GraphicsDevice); base.LoadContent(); Tileset = null; using (MemoryStream stream = new MemoryStream()) { MapEditor.Data.Resources.ox.Save(stream, ImageFormat.Png); ox = new TileableTexture(Texture2D.FromStream(EditorEngine.Instance.GraphicsDevice, stream), 2, 1); } }
public object Clone() { Tileset tileset = new Tileset(); Tile[] tiles = this.Tiles.ToArray(); tileset.Tiles.AddRange(tiles); tileset.Name = (string)this.Name.Clone(); tileset.Texture = (TileableTexture)this.Texture.Clone(); return tileset; }
public void addTileset(Tileset tilesheet) { World.TilesetContainer.Add(tilesheet); }