question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow different initial shapes besides rectangle

See original GitHub issue

Useful for initial placeholder actors. If I want to draw a planet, it’d be nice to let Excalibur do it for me vs. me writing custom canvas code. Also, you can’t add an initial color because then Excalibur will draw the rectangle if you call super.draw so you have to start with a null color.

Bonus: Changes shape of bounding box too.

Proposed Actor API

// default
protected defaultDraw(ctx, delta) {
  // draw rect
}

// override
protected defaultDraw(ctx, delta) {
  // custom drawing of shape or default draw
  ex.Drawing.drawCircle(ctx, 5, this.color);
  ex.Drawing.drawEllipse(ctx, 5, 6, this.color);
}

Circle

Assumes width and height are equal (use width / 2)

ctx.beginPath();
ctx.arc(0, 0, this.getWidth() / 2, 0, Math.PI * 2);
ctx.fillStyle = this.color.toString();
ctx.closePath();
ctx.fill();

Ellipse

Uses width / 2 and height / 2

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
kamranayubcommented, May 5, 2018

Yep, it’s a good idea to open up a work in progress PR so we can keep up with what you’re working on and discuss any questions or design ideas you have!

On Fri, May 4, 2018, 21:54 jedeen notifications@github.com wrote:

Yep! Take a look at our updated contributing guide https://github.com/excaliburjs/Excalibur/blob/master/.github/CONTRIBUTING.md, and go ahead!

I’ll assign this issue to myself for tracking. Let us know if you have any questions!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/excaliburjs/Excalibur/issues/562#issuecomment-386774176, or mute the thread https://github.com/notifications/unsubscribe-auth/AAiaa8l_EPbqlFkxMtXu1O7qDE02CP6oks5tvRRVgaJpZM4HK_gd .

1reaction
jedeencommented, May 5, 2018

Yep! Take a look at our updated contributing guide, and go ahead!

I’ll assign this issue to myself for tracking. Let us know if you have any questions!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shape basics: resize, format, move and add text to shapes
A 2-D shape behaves like a rectangle. Select one or more shapes. You can select all shapes in the page by pressing Ctrl+A....
Read more >
The 9 Most Common Shapes and How to Identify Them
Squares, rectangles, and rhombuses are all parallelograms. Squares and rectangles use the same basic formulas for area—length times height.
Read more >
Two methods for creating non-standard shapes in PowerPoint
In this video I show two methods to create a non-standard shape. This can be useful when you are using an overlay on...
Read more >
How to Draw Shapes with the Shape Tools in Photoshop
Click and hold on the Rectangle Tool's icon to open a fly-out menu showing the other shape tools hiding behind it. We'll look...
Read more >
Create and customize shapes and masks in After Effects
Creating shapes · More videos on YouTube · Convert Vector Art Footage to Shape · Create a shape dragging with shape tools ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found