playif / play_phaser

A Dart port for Phaser 2D game engine.
MIT License
72 stars 13 forks source link

Canvas not being put into page when running compiled .dart.js file #33

Open TheIceMageX50 opened 9 years ago

TheIceMageX50 commented 9 years ago

I recently decided to test trying to run the dart.js output of my project by setting up a site via Github pages. Unfortunately I get this error in the browser console and the canvas I try to insert via code is not there

Uncaught TypeError: Cannot read property 'append$1' of null

My site for it is here so if you open devtools in Chrome for example you can see a stack trace, with source-maps. Sadly I think I may have accidentally borked something with the source map because the links in the dev tools don't quite seem to link to what they say they do in some cases but it's still fairly ok.

I was trying to debug this issue with a friend and they mentioned that one slight issue in the Phaser code here as well is the Game constructor's param parent is typed String but really the code within accepts String or Element or something like that, so that's a little misleading. Oh and another thing, when I use Points in my code I get a warning in DartEditor about how phaser.dart (lib file) implicitly hides Point from math package. So I think your library file import of dart:math should read like import 'dart:math' hide Point; It may not be an issue in my case with what I've been doing but to quote my friend when we were talking about my issue....if you don't hide things like so "Dart has to guess what you mean and may guess wrong".