add TODOs for places where "new" is used during per-frame code

Fixes #12.
This commit is contained in:
Colin McMillen 2020-03-18 11:11:40 -04:00
parent fb3538cea9
commit 7625339d4c
3 changed files with 4 additions and 0 deletions

View File

@ -51,6 +51,7 @@ namespace SemiColinGames {
}
// This creates and populates a new array. It's O(n) and should probably only be used for tests.
// TODO: restrict visibility so that it can only be used by tests.
public T[] ToArray() {
T[] result = new T[items.Length];
for (int i = 0; i < items.Length; i++) {

View File

@ -22,6 +22,7 @@ namespace SemiColinGames {
int errorXY; // Error value e_xy from the PDF.
// The size of the output is the size of the longer dimension, plus one.
int resultSize = Math.Max(dx, -dy) + 1;
// TODO: an array or list should be passed in by the caller.
var result = new Point[resultSize];
int i = 0;

View File

@ -83,6 +83,8 @@ namespace SemiColinGames {
}
bool harmedByCollision = false;
// TODO: pass in movePoints to Line.Rasterize instead of having that function allocate a
// new array.
Point[] movePoints = Line.Rasterize(0, 0, (int) movement.X, (int) movement.Y);
for (int i = 1; i < movePoints.Length; i++) {
int dx = movePoints[i].X - movePoints[i - 1].X;