Grid ClassDelta Engine Documentation
Represents a grid of bricks: the blocks that have come to rest and not yet been removed View code on GitHub
Inheritance Hierarchy

System Object
  Blocks Grid

Namespace: Blocks
Assembly: Blocks (in Blocks.exe) Version: 1.1.1.0 (1.1.1)
Syntax

public class Grid

The Grid type exposes the following members.

Constructors

  NameDescription
Public methodGrid
Initializes a new instance of the Grid class
Top
Methods

  NameDescription
Public methodAffixBlock
Public methodClear
Public methodGetValidStartingColumns
Public methodIsABrickOnFirstRow
Public methodIsValidPosition
Top
Remarks

Tests: Blocks.Tests.GridTests
Examples

11 unit tests call Blocks.Grid
[Test, Ignore]
public void AffixBlocksWhichFillOneRow()
{
    Assert.AreEqual(0,
        AffixBlocks(grid, new[] { new Vector2D(0, 18), new Vector2D(4, 18), new Vector2D(7, 18) }));
    //using (NUnit.Framework.Randomizer.Use(new FixedRandom(IBlock))) 
    //{
        Assert.AreEqual(1, grid.AffixBlock(new Block(displayMode, content, new Vector2D(11, 15))));
        Assert.AreEqual(3, ControllerTests.CountBricks(grid));
        Assert.IsNotNull(grid.bricks[11, 16]);
        Assert.IsNotNull(grid.bricks[11, 17]);
        Assert.IsNotNull(grid.bricks[11, 18]);
    //}
[Test, Ignore]
public void AffixBlocksWhichFillTwoRows()
{
    Assert.AreEqual(0,
        AffixBlocks(grid,
            new[]
            {
                new Vector2D(0, 17), new Vector2D(4, 17), new Vector2D(7, 17), new Vector2D(0, 18),
                new Vector2D(4, 18), new Vector2D(7, 18)
            }));
    //using (NUnit.Framework.Randomizer.Use(new FixedRandom(IBlock))) 
    //{
    Assert.AreEqual(2, grid.AffixBlock(new Block(displayMode, content, new Vector2D(11, 15))));
    Assert.AreEqual(2, ControllerTests.CountBricks(grid));
    Assert.IsNotNull(grid.bricks[11, 17]);
    Assert.IsNotNull(grid.bricks[11, 18]);
    //}
[Test, Ignore]
public void RowsDontSplit()
{
    content.DoBricksSplitInHalfWhenRowFull = false;
    Assert.AreEqual(0,
        AffixBlocks(grid, new[] { new Vector2D(0, 18), new Vector2D(4, 18), new Vector2D(7, 18) }));
    //using (NUnit.Framework.Randomizer.Use(new FixedRandom(IBlock))) 
    //{
        Assert.AreEqual(1, grid.AffixBlock(new Block(displayMode, content, new Vector2D(11, 15))));
        AdvanceTimeAndUpdateEntities();
        //Assert.AreEqual(30, entitySystem.GetHandler<Render>().NumberOfActiveRenderableObjects); 
    //}
See Also