Esempio n. 1
0
        private VertexArray GenerateMap(uint Width, uint Hiegth)
        {
            var result = new VertexArray(PrimitiveType.Quads, 4 * Width * Hiegth);

            var map = GenerateMap(100, 100, 8, 20);

            for (var y = 0; y < 100; y++)
            {
                for (var x = 0; x < 100; x++)
                {
                    if (map[y][x] != 1)
                    {
                        continue;
                    }

                    var position = new Vector2f(x, y) * _tileSet.TileSize;
                    result.AppendAll(_tileSet.BuildQuad(1, position));
                }
            }

            //for (int y = 0; y < Hiegth; y++)
            //{
            //	for (int x = 0; x < Width; x++)
            //	{
            //		var position = new Vector2f(x, y) * _tileSet.TileSize;
            //		var tileIndex = TileIndexFromPosition(x, y, (int)Width, (int)Hiegth);
            //		result.AppendAll(_tileSet.BuildQuad(tileIndex, position));
            //	}
            //}

            return(result);
        }