protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); device = graphics.GraphicsDevice; ITileDef[,] map = new ITileDef[size, size]; for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) { map[x, y] = new Ground(x < 3?Ground.GroundType.Grass : Ground.GroundType.Dirt); } } texture2D_ = new Texture2D(device, size, size); Color[] colors = new Color[size * size]; for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) { colors[x * size + y] = map[x, y].GetMapColor(); } } texture2D_.SetData(colors); }
/// <summary> /// Adds a tile definition object to an uncompiled list of tiles and assigns that tile a unique ID /// within the database. /// </summary> /// <param name="tile">ITileDef object that contains information about the added tile</param> /// <returns>Newly assigned ID for a given tile</returns> public virtual int Add(ITileDef tile) { tile.ID = m_UncompiledTileDefs.Count; m_UncompiledTileDefs.Add(tile); m_TileIndex.Add(tile.Keyword, tile); return(tile.ID); }