|
@@ -54,6 +54,9 @@ namespace bbiwarg.Graphics
|
|
|
public void updateImage()
|
|
|
{
|
|
|
OutputImage = new OutputImage(width, height);
|
|
|
+ bool touched = currentTouchPositions != null ? true : false;
|
|
|
+ int touchX = touched ? currentTouchPositions.Last<Vector2D>().IntX : -1;
|
|
|
+ int touchY = touched ? currentTouchPositions.Last<Vector2D>().IntY : -1;
|
|
|
|
|
|
//-- Border --
|
|
|
int size = Math.Min(width, height);
|
|
@@ -63,26 +66,49 @@ namespace bbiwarg.Graphics
|
|
|
//-- Grid --
|
|
|
int numRows = Constants.PalmGridRows;
|
|
|
int numColumns = Constants.PalmGridColumns;
|
|
|
-
|
|
|
- for (int i = 1; i < numRows; i++)
|
|
|
+ int cellX1 = -1;
|
|
|
+ int cellY1 = -1;
|
|
|
+ int cellX2 = -1;
|
|
|
+ int cellY2 = -1;
|
|
|
+ int tmp = -1;
|
|
|
+ int tmp2 = -1;
|
|
|
+
|
|
|
+ for (int i = 0; i < numRows; i++)
|
|
|
{
|
|
|
- int tmp = size / numRows * i;
|
|
|
+ tmp = size / numRows * i;
|
|
|
+ tmp2 = size / numRows * (i + 1);
|
|
|
OutputImage.drawLineSegment(new LineSegment2D(new Vector2D(0, tmp), new Vector2D(size - 2, tmp)), Constants.PalmGridColor);
|
|
|
+ if (touched)
|
|
|
+ if (touchY >= tmp && touchY < tmp2)
|
|
|
+ {
|
|
|
+ cellY1 = tmp;
|
|
|
+ cellY2 = tmp2;
|
|
|
+ }
|
|
|
}
|
|
|
- for (int i = 1; i < numColumns; i++)
|
|
|
+ for (int i = 0; i < numColumns; i++)
|
|
|
{
|
|
|
- int tmp = size / numColumns * i;
|
|
|
+ tmp = size / numColumns * i;
|
|
|
+ tmp2 = size / numColumns * (i + 1);
|
|
|
OutputImage.drawLineSegment(new LineSegment2D(new Vector2D(tmp, 0), new Vector2D(tmp, size - 2)), Constants.PalmGridColor);
|
|
|
+ if (touched)
|
|
|
+ if (touchX >= tmp && touchX < tmp2)
|
|
|
+ {
|
|
|
+ cellX1 = tmp;
|
|
|
+ cellX2 = tmp2;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ if (touched)
|
|
|
+ OutputImage.drawRectangle(cellX1, cellY1, size/numColumns, size/numRows, Color.Gray, -1);
|
|
|
+
|
|
|
//-- Current Touch Event --
|
|
|
- if (currentTouchPositions != null)
|
|
|
+ if (touched)
|
|
|
{
|
|
|
for (int i = 1; i < currentTouchPositions.Count; ++i)
|
|
|
{
|
|
|
OutputImage.drawLineSegment(new LineSegment2D(currentTouchPositions[i - 1], currentTouchPositions[i]), Constants.TouchEventVisualizerLineColor);
|
|
|
}
|
|
|
- OutputImage.fillCircle(currentTouchPositions.Last<Vector2D>().IntX, currentTouchPositions.Last<Vector2D>().IntY, 3, Constants.TouchEventVisualizerPointColor);
|
|
|
+ OutputImage.fillCircle(touchX, touchY, 3, Constants.TouchEventVisualizerPointColor);
|
|
|
}
|
|
|
//-- Last Touch Event --
|
|
|
if (lastTouchPositions != null)
|
|
@@ -93,7 +119,7 @@ namespace bbiwarg.Graphics
|
|
|
}
|
|
|
OutputImage.fillCircle(lastTouchPositions.Last<Vector2D>().IntX, lastTouchPositions.Last<Vector2D>().IntY, 3, Constants.TouchEventVisualizerPointColor);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public void Reset()
|