add TODOs for places where "new" is used during per-frame code
Fixes #12.
This commit is contained in:
parent
fb3538cea9
commit
7625339d4c
@ -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.
|
// 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() {
|
public T[] ToArray() {
|
||||||
T[] result = new T[items.Length];
|
T[] result = new T[items.Length];
|
||||||
for (int i = 0; i < items.Length; i++) {
|
for (int i = 0; i < items.Length; i++) {
|
||||||
|
@ -22,6 +22,7 @@ namespace SemiColinGames {
|
|||||||
int errorXY; // Error value e_xy from the PDF.
|
int errorXY; // Error value e_xy from the PDF.
|
||||||
// The size of the output is the size of the longer dimension, plus one.
|
// The size of the output is the size of the longer dimension, plus one.
|
||||||
int resultSize = Math.Max(dx, -dy) + 1;
|
int resultSize = Math.Max(dx, -dy) + 1;
|
||||||
|
// TODO: an array or list should be passed in by the caller.
|
||||||
var result = new Point[resultSize];
|
var result = new Point[resultSize];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -83,6 +83,8 @@ namespace SemiColinGames {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool harmedByCollision = false;
|
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);
|
Point[] movePoints = Line.Rasterize(0, 0, (int) movement.X, (int) movement.Y);
|
||||||
for (int i = 1; i < movePoints.Length; i++) {
|
for (int i = 1; i < movePoints.Length; i++) {
|
||||||
int dx = movePoints[i].X - movePoints[i - 1].X;
|
int dx = movePoints[i].X - movePoints[i - 1].X;
|
||||||
|
Loading…
Reference in New Issue
Block a user