/// <summary> /// Adds a new layer to the map. /// </summary> /// <param name="map"> /// The map model. /// </param> /// <param name="width">The layer width.</param> /// <param name="height">The layer height.</param> public static Map2DLayerModel AddNewLayer(this Map2DModel map, int width, int height) { if (map == null) { throw new ArgumentNullException("map"); } if (map.Layers == null) { map.Layers = new List <Map2DLayerModel>(); } var model = new Map2DLayerModel(); model.Image = new GenericImage <Color>(width, height); model.Image.Clear(Color.Green); model.Texture = model.Image.ToTexture2D(); map.Layers.Add(model); if (map.ActiveLayer < 0) { map.ActiveLayer = map.Layers.Count - 1; } Map2DService.Instance.OnNewMapLayer(Map2DService.Instance, new MapEventArgs(map)); return(model); }
/// <summary> /// Creates a new Map2D map. /// </summary> public void StartNewMap() { var map = new Map2DModel(); this.maps.Add(map); if (this.ActiveMapIndex < 0) { this.ActiveMapIndex = this.maps.Count - 1; } this.OnNewMapStarted(); var model = map.AddNewLayer(512, 256); model.Name = "Untitled"; }
/// <summary> /// Initializes a new instance of the <see cref="MapEventArgs"/> class. /// </summary> /// <param name="map"> /// Sets the initial value of the <see cref="Map"/> property. /// </param> public MapEventArgs(Map2DModel map) { this.Map = map; }
/// <summary> /// Creates a new Map2D map. /// </summary> public void StartNewMap() { var map = new Map2DModel(); this.maps.Add(map); if (this.ActiveMapIndex < 0) { this.ActiveMapIndex = this.maps.Count - 1; } this.OnNewMapStarted(); var model = map.AddNewLayer(512, 256); model.Name = "Untitled"; }
/// <summary> /// Initializes a new instance of the <see cref="MapEventArgs"/> class. /// </summary> /// <param name="map"> /// Sets the initial value of the <see cref="Map"/> property. /// </param> public MapEventArgs(Map2DModel map) { this.Map = map; }