Skip to content
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);