TouchEvent.cs 884 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace bbiwarg.Detectors.Touch
  7. {
  8. class TouchEvent
  9. {
  10. private int x;
  11. private int y;
  12. private float touchValue;
  13. public TouchEvent(int x, int y, float touchValue) {
  14. this.x = x;
  15. this.y = y;
  16. this.touchValue = touchValue;
  17. }
  18. public int getX() {
  19. return x;
  20. }
  21. public int getY() {
  22. return y;
  23. }
  24. public float getTouchValue() {
  25. return touchValue;
  26. }
  27. public float getDistanceTo(TouchEvent te) {
  28. int xDiff = x - te.getX();
  29. int yDiff = y - te.getY();
  30. float distance = (float)Math.Sqrt(xDiff * xDiff + yDiff * yDiff);
  31. return distance;
  32. }
  33. }
  34. }