/// <summary> /// place un block dans le font /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="block"></param> public void SetBackBlock(int x, int y, Block block) { Chunk chunk = GetBlockBackChunk(x, y); int tx = x % 16; int ty = y % 16; if (x < 0) { tx += 15; } if (y < 0) { ty += 15; } if (chunk == null) { chunk = new Chunk(new Block[16, 16], true); backChunks.Add(GenerateurParDefault.Convert(x) + "/" + GenerateurParDefault.Convert(y), chunk); } chunk.SetBlock(tx, ty, block); }
/// <summary> /// recupere un block de font /// </summary> /// <param name="bx"></param> /// <param name="by"></param> /// <returns>peut etre null</returns> public Block GetBackBlock(int bx, int by) { Chunk chunk = GetBlockBackChunk(bx, by); if (chunk == null) { backChunks.Add(GenerateurParDefault.Convert(bx) + "/" + GenerateurParDefault.Convert(by), new Chunk(new Block[16, 16], true)); chunk = GetBlockBackChunk(bx, by); } int tx = bx % 16; int ty = by % 16; if (bx < 0) { tx += 15; } if (by < 0) { ty += 15; } return(chunk.GetBlock(tx, ty)); }