From 47e6cff967d7c6575ab68fa7a8315d1b6b5aef6d Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Thu, 30 Mar 2017 01:47:15 +0100 Subject: [PATCH] Added Graphics.fillPoint, fillPointShape and lineBetween methods. --- v3/src/gameobjects/graphics/Graphics.js | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/v3/src/gameobjects/graphics/Graphics.js b/v3/src/gameobjects/graphics/Graphics.js index f590fed77..bc8a2ac1c 100644 --- a/v3/src/gameobjects/graphics/Graphics.js +++ b/v3/src/gameobjects/graphics/Graphics.js @@ -195,6 +195,23 @@ var Graphics = new Class({ return this; }, + // POINT + + fillPointShape: function (point, size) + { + return this.fillPoint(point.x, point.y, size); + }, + + fillPoint: function (x, y, size) + { + this.commandBuffer.push( + Commands.FILL_RECT, + x, y, size, size + ); + + return this; + }, + // TRIANGLE fillTriangleShape: function (triangle) @@ -236,6 +253,17 @@ var Graphics = new Class({ return this.lineTo(line.x2, line.y2); }, + lineBetween: function (x1, y1, x2, y2) + { + this.beginPath(); + this.moveTo(x1, y1); + this.lineTo(x2, y2); + this.strokePath(); + this.closePath(); + + return this; + }, + lineTo: function (x, y) { this.commandBuffer.push(