Kreeba Posted August 14, 2017 Share Posted August 14, 2017 Hello. I apologies for multiple threads around the same issue, but I honestly feel very frustrated. I am waiting for the NPM package of Babylon and Babylon.gui to be refactored to support moduler importing. Until then does anyone have a working example showing how to correctly reference Babylon and Babylon.GUI in a TypeScript project so it compiles and references correctly in the front end? I don't mind if it using CDN/Local Files/NPM anything, I will just adjust my code to match. I have been stalled for around 3 weeks on this issue, and mostly am frustrated at myself for not having the technical skills to assist. TypeScript and Babylon are an excellent combination, however this technical area is still a 'black art' to me. Any push in the right direction is very welcome. Quote Link to comment Share on other sites More sharing options...
brianzinn Posted August 15, 2017 Share Posted August 15, 2017 I just copied all the GUI files into my project and modified them. It only took 15 minutes to modify the files. At the top of ie: math2d.ts I have "import { Vector2, Epsilon } from 'babylonjs'" and then I removed the BABYLON. in the file itself. It doesn't update obviously like an NPM, but no need to be stalled with an open source project. Quote Link to comment Share on other sites More sharing options...
Kreeba Posted August 15, 2017 Author Share Posted August 15, 2017 Is it possible you could share it with me? Quote Link to comment Share on other sites More sharing options...
brianzinn Posted August 15, 2017 Share Posted August 15, 2017 I sent you a PM with my email. So, I'm not recommending this solution, but it does work. Quote Link to comment Share on other sites More sharing options...
Kreeba Posted August 15, 2017 Author Share Posted August 15, 2017 Thanks. Sent my email back to you. I won't release the game like this, I just want get back to developing. By the time I am close to releasing I am sure they would have refactored the code base to support modular NPM packages. Quote Link to comment Share on other sites More sharing options...
brianzinn Posted August 15, 2017 Share Posted August 15, 2017 OK. Hope what I sent you gets you going in the meantime. Quote Link to comment Share on other sites More sharing options...
Kreeba Posted August 16, 2017 Author Share Posted August 16, 2017 Thanks. I got it working. I basically stripped out all referencing and started again. What worked for me was to do a /// reference in the source files to the Babylon typescript definitions so the IDE/TSC was happy. Then separately I used the online build tool to build a version of Babylon with GUI already in. Then linked that in the html container file. I will make a video later just to help anyone coming after me with the same issue. brianzinn 1 Quote Link to comment Share on other sites More sharing options...
Kreeba Posted August 16, 2017 Author Share Posted August 16, 2017 Hi. I have created this quick video just to show you my solution if anyone else comes across the same problem. I apologise if it seems very obvious to anyone with TypeScript experience, but this is squarely aimed at TypeScript beginners who just want to get on with game dev: GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.