From 0cb811ef06d4f22ad73c399d4ac2123a4f24472b Mon Sep 17 00:00:00 2001 From: Viktor Lidholt Date: Fri, 25 Sep 2015 13:12:01 -0700 Subject: [PATCH] Renames pointQuickDist in GameMath --- examples/game/lib/game_objects.dart | 2 +- packages/flutter_sprites/lib/effect_line.dart | 4 ++-- packages/flutter_sprites/lib/textured_line.dart | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/game/lib/game_objects.dart b/examples/game/lib/game_objects.dart index f05fa2d6c4..356eb5a170 100644 --- a/examples/game/lib/game_objects.dart +++ b/examples/game/lib/game_objects.dart @@ -19,7 +19,7 @@ abstract class GameObject extends Node { ..setStyle(sky.PaintingStyle.stroke); bool collidingWith(GameObject obj) { - return (GameMath.pointQuickDist(position, obj.position) + return (GameMath.distanceBetweenPoints(position, obj.position) < radius + obj.radius); } diff --git a/packages/flutter_sprites/lib/effect_line.dart b/packages/flutter_sprites/lib/effect_line.dart index a11658d5f0..211e15d057 100644 --- a/packages/flutter_sprites/lib/effect_line.dart +++ b/packages/flutter_sprites/lib/effect_line.dart @@ -105,7 +105,7 @@ class EffectLine extends Node { while(_points.length > 0 && _pointAges[0] > (fadeDuration + fadeAfterDelay)) { // Update scroll if it isn't the last and only point that is about to removed if (_points.length > 1 && textureLoopLength != null) { - double dist = GameMath.pointQuickDist(_points[0], _points[1]); + double dist = GameMath.distanceBetweenPoints(_points[0], _points[1]); _offset = (_offset - (dist / textureLoopLength)) % 1.0; if (_offset < 0.0) _offset += 1; } @@ -167,7 +167,7 @@ class EffectLine extends Node { if (points.length > 0 && point.x == points[points.length - 1].x && point.y == points[points.length - 1].y) return; - if (simplify && points.length >= 2 && GameMath.pointQuickDist(point, points[points.length - 2]) < 10.0) { + if (simplify && points.length >= 2 && GameMath.distanceBetweenPoints(point, points[points.length - 2]) < 10.0) { // Check if we should remove last point before adding the new one // Calculate the square distance from the middle point to the line of the diff --git a/packages/flutter_sprites/lib/textured_line.dart b/packages/flutter_sprites/lib/textured_line.dart index 104c65ee26..bf857d97c0 100644 --- a/packages/flutter_sprites/lib/textured_line.dart +++ b/packages/flutter_sprites/lib/textured_line.dart @@ -196,7 +196,7 @@ class TexturedLinePainter { Point intersection = GameMath.lineIntersection(oldVertex0, oldVertex1, vertex0, vertex1); if (intersection != null) { - if (GameMath.pointQuickDist(vertex0, intersection) < GameMath.pointQuickDist(vertex1, intersection)) { + if (GameMath.distanceBetweenPoints(vertex0, intersection) < GameMath.distanceBetweenPoints(vertex1, intersection)) { vertex0 = oldVertex0; } else { vertex1 = oldVertex1; @@ -220,7 +220,7 @@ class TexturedLinePainter { Point lastPoint = _points[i - 1]; Point currentPoint = _points[i]; - double dist = GameMath.pointQuickDist(lastPoint, currentPoint); + double dist = GameMath.distanceBetweenPoints(lastPoint, currentPoint); length += dist; stops.add(length); }