Skip to content

Commit 47e6cff

Browse files
committed
Added Graphics.fillPoint, fillPointShape and lineBetween methods.
1 parent 709819d commit 47e6cff

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

v3/src/gameobjects/graphics/Graphics.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,23 @@ var Graphics = new Class({
195195
return this;
196196
},
197197

198+
// POINT
199+
200+
fillPointShape: function (point, size)
201+
{
202+
return this.fillPoint(point.x, point.y, size);
203+
},
204+
205+
fillPoint: function (x, y, size)
206+
{
207+
this.commandBuffer.push(
208+
Commands.FILL_RECT,
209+
x, y, size, size
210+
);
211+
212+
return this;
213+
},
214+
198215
// TRIANGLE
199216

200217
fillTriangleShape: function (triangle)
@@ -236,6 +253,17 @@ var Graphics = new Class({
236253
return this.lineTo(line.x2, line.y2);
237254
},
238255

256+
lineBetween: function (x1, y1, x2, y2)
257+
{
258+
this.beginPath();
259+
this.moveTo(x1, y1);
260+
this.lineTo(x2, y2);
261+
this.strokePath();
262+
this.closePath();
263+
264+
return this;
265+
},
266+
239267
lineTo: function (x, y)
240268
{
241269
this.commandBuffer.push(

0 commit comments

Comments
 (0)