Skip to content

Updated fill rounded rectangle format to ES6 #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions public/src/game objects/graphics/fill rounded rectangle.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
var config = {
width: 800,
height: 600,
type: Phaser.AUTO,
parent: 'phaser-example',
scene: {
create: create
}
};

var game = new Phaser.Game(config);

var graphics;
let graphics;

function create ()
class Example extends Phaser.Scene
{
graphics = this.add.graphics();
create ()
{
graphics = this.add.graphics();

graphics.fillStyle(0xffff00, 1);
graphics.fillStyle(0xffff00, 1);

// 32px radius on the corners
graphics.fillRoundedRect(32, 32, 300, 200, 32);
// 32px radius on the corners
graphics.fillRoundedRect(32, 32, 300, 200, 32);

graphics.fillStyle(0xff00ff, 1);
graphics.fillStyle(0xff00ff, 1);

// Using an object to define a different radius per corner
graphics.fillRoundedRect(360, 240, 400, 300, { tl: 64, tr: 22, bl: 12, br: 0 });
// Using an object to define a different radius per corner
graphics.fillRoundedRect(360, 240, 400, 300, { tl: 64, tr: 22, bl: 12, br: 0 });
}
}

let config = {
width: 800,
height: 600,
type: Phaser.AUTO,
parent: 'phaser-example',
scene: [ Example ]
};

const game = new Phaser.Game(config);