kittykatattack / ga

The world's tiniest, cutest and funnest game engine
451 stars 85 forks source link

Fix incorrect fullscreen check #80

Open cdrch opened 2 years ago

cdrch commented 2 years ago

Fixes a problem introduced with the addition of fullscreen. Previously, the pointer placement had been incorrectly scaled due to the scale constantly resetting, which was caused by an incorrect call to fullscreenEnabled, which checks whether or not a browser can support fullscreen, rather than if it is currently. It has been replaced in this PR with checking if there are any current elements of the page in fullscreen; if none (document.fullscreenElement != null), then it is considered not fullscreen. Otherwise, it is.

This should fix #65 and potentially help with solving #33.

Update: found other areas of code with the same issue. Flappy Fairy now goes properly fullscreen. Fixes #45 and #78.