Jump to content

trying to port painting game to phaser 3 and lineCap is missing from graphics


Taribuna
 Share

Recommended Posts

Hello,
I am trying to port a coloring book "game" from phaser 2 to phaser 3. 
Now in the original we used to do a simpe draw with the mouse using:
 

var canvas = this.make.bitmapData(800, 600);
var ctx = canvas.ctx;
ctx.lineWidth = 20;
ctx.lineJoin = ctx.lineCap = 'round';
ctx.strokeStyle = '#000000';

// and then in the mouse move function


ctx.beginPath();	
ctx.moveTo(last_pos.x, last_pos.y);
ctx.lineTo(pointer.x, pointer.y);
ctx.stroke();
ctx.closePath();

Now in the new Graphics Class I did not find a way to set the lineCap to round. 
Hence when I run:
 

var canvas = this.add.graphics();
canvas.lineStyle(20, 0x000000, 1);
canvas.beginPath();
canvas.moveTo(drawpoint.x, drawpoint.y);
canvas.lineTo(pointer.x,pointer.y);
canvas.fillPath()
canvas.strokePath();
canvas.closePath();

i am not getting a nice smooth line but rather the very jagged path that I would get if I did not set lineCap to "round" in the old version. 


Any Ideas what I could do?
thanks!

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...