Main Site Documentation

BrainPad TinyCLR missing ClearPart definition


I’m working through the Space Invasion project (part of the Go Beyond series) using the TinyCLR.BrainPad package for C#.

In it, there is a method ClearPart(X, Y, Width, Height) used to clear the existing object rectangle. However, it appears that the ClearPart method does not exist in the current (v1.0.0.0) version of the BrainPad NuGet package.

I couldn’t find an equivalent. I thought I could use the DrawFilledRectangle, however, there was no way to set the fill color to ‘black’ so it just draws a solid box.

Can someple please provide an answer. I find it hard to believe that a publised demo on the brainpad mainsight has incorrect code, and that I’m the first one to discover this problem.

I’ll keep looking but at this point, I am at a loss for a solution (other than looping through each pixel using ClearPoint).


Looks like it was mistakenly removed in a previous change, we’ll add it back in a future release. Sorry for the inconvenience.

For now, I’ve copied one possible implementation below, which loops calls to ClearPoint as you suspected.

public void ClearPart(int x, int y, int width, int height) { 
	if (x == 0 && y == 0 && width == BrainPad.Display.Width && height == BrainPad.Display.Height)

	for (var lx = x; lx < width + x; lx++) 
		for (var ly = y; ly < height + y; ly++) 
			BrainPad.Display.ClearPoint(lx, ly);