TannerRogalsky / punchdrunk

An attempt to replicate the LÖVE API in the browser using moonshine.
http://tannerrogalsky.com/punchdrunk/
MIT License
81 stars 10 forks source link

hang with this fiddle #42

Closed seanjensengrey closed 10 years ago

seanjensengrey commented 10 years ago

http://lovefiddle.com/78b2f46d0e47efc495dd13b63f7e09cc66afa2fa

TannerRogalsky commented 10 years ago

Interesting! I assume you're seeing something like this? screen shot 2014-07-11 at 7 34 40 am I see that under iOS and OS X using Chrome but it renders properly on my Windows 7 machine using Chrome. I'll definitely look into this this weekend. Thanks for reporting it!

TannerRogalsky commented 10 years ago

Actually, the browser gives us a useful error message: Error: Failed to execute 'arc' on 'CanvasRenderingContext2D': The radius provided (-22.5) is negative. Seems that some graphics drivers will not do that. I will check for a negative radius in the arc function and handle it appropriately.

paulcuth commented 10 years ago

I was just about to say the same. Looking into it further, Chrome is behaving correctly here; the spec does say:

Negative values for radiusX or radiusY must cause the implementation to throw an IndexSizeError exception.
TannerRogalsky commented 10 years ago

Good news and bad news:

The good news is that that fiddle is now working.

The bad news is that I still have not entirely fixed the issue that this has exposed. The disconnect between the 2D Canvas implementation of arc drawing and Love's method (which is just to draw a series of lines and then use a triangle fan) results in an awful lot of edge cases. I'm going to leave this on the fix_arc branch until I can come up with a more satisfying solution. The relevant commit is here: a4e79f6c9d6ff21fe7477b06d0cf1946de4566a7

TannerRogalsky commented 10 years ago

Resolved via #44.