diff -ru spa/app_package/src/Playground/Assets.ts spb/app_package/src/Playground/Assets.ts --- spa/app_package/src/Playground/Assets.ts +++ spb/app_package/src/Playground/Assets.ts @@ -124,14 +124,7 @@ } _this.starfieldMaterial = nodeMaterial; console.log("Minimal asset loading done"); - if (useNative) { - Tools.LoadFileAsync("https://raw.githubusercontent.com/CedricGuillemet/dump/master/droidsans.ttf", true).then((data) => { - _native.Canvas.loadTTFAsync("Arial", data); - whenReady(_this); - }); - } else { - whenReady(_this); - } + whenReady(_this); // minimal done this._completeLoading(scene, assetsHostUrl, whenLoadingComplete); }); diff -ru spa/app_package/src/Playground/GuiFramework.ts spb/app_package/src/Playground/GuiFramework.ts --- spa/app_package/src/Playground/GuiFramework.ts +++ spb/app_package/src/Playground/GuiFramework.ts @@ -49,9 +49,9 @@ } public static createBottomBar(adt: AdvancedDynamicTexture) { - let bottomBarLeft: Image = new Image("bottomBarLeft", "/assets/UI/bottomBarLeft.svg"); - let bottomBarCenter: Image = new Image("bottomBarCenter", "/assets/UI/bottomBarCenter.svg"); - let bottomBarRight: Image = new Image("bottomBarRight", "/assets/UI/bottomBarRight.svg"); + let bottomBarLeft: Image = new Image("bottomBarLeft", "assets/UI/bottomBarLeft.svg"); + let bottomBarCenter: Image = new Image("bottomBarCenter", "assets/UI/bottomBarCenter.svg"); + let bottomBarRight: Image = new Image("bottomBarRight", "assets/UI/bottomBarRight.svg"); let grid: Grid = new Grid(); grid.addRowDefinition(270, true); grid.addColumnDefinition(645, true); @@ -82,15 +82,15 @@ } public static createTextPanel(parentGrid: Grid) { - let textPanelUL: Image = new Image("bottomBarLeft", "/assets/UI/textPanelUL.svg"); - let textPanelUC: Image = new Image("bottomBarCenter", "/assets/UI/textPanelUC.svg"); - let textPanelUR: Image = new Image("bottomBarRight", "/assets/UI/textPanelUR.svg"); - let textPanelCL: Image = new Image("bottomBarLeft", "/assets/UI/textPanelCL.svg"); - let textPanelCC: Image = new Image("bottomBarCenter", "/assets/UI/textPanelCC.svg"); - let textPanelCR: Image = new Image("bottomBarRight", "/assets/UI/textPanelCR.svg"); - let textPanelLL: Image = new Image("bottomBarLeft", "/assets/UI/textPanelLL.svg"); - let textPanelLC: Image = new Image("bottomBarCenter", "/assets/UI/textPanelLC.svg"); - let textPanelLR: Image = new Image("bottomBarRight", "/assets/UI/textPanelLR.svg"); + let textPanelUL: Image = new Image("bottomBarLeft", "assets/UI/textPanelUL.svg"); + let textPanelUC: Image = new Image("bottomBarCenter", "assets/UI/textPanelUC.svg"); + let textPanelUR: Image = new Image("bottomBarRight", "assets/UI/textPanelUR.svg"); + let textPanelCL: Image = new Image("bottomBarLeft", "assets/UI/textPanelCL.svg"); + let textPanelCC: Image = new Image("bottomBarCenter", "assets/UI/textPanelCC.svg"); + let textPanelCR: Image = new Image("bottomBarRight", "assets/UI/textPanelCR.svg"); + let textPanelLL: Image = new Image("bottomBarLeft", "assets/UI/textPanelLL.svg"); + let textPanelLC: Image = new Image("bottomBarCenter", "assets/UI/textPanelLC.svg"); + let textPanelLR: Image = new Image("bottomBarRight", "assets/UI/textPanelLR.svg"); let grid: Grid = new Grid(); grid.clipChildren = false; grid.addRowDefinition(170, true); @@ -333,7 +333,7 @@ } public static addButton(label: string, panel: StackPanel): Button { - var button = Button.CreateImageButton("button", label.toUpperCase(), "/assets/UI/menuButton.svg"); + var button = Button.CreateImageButton("button", label.toUpperCase(), "assets/UI/menuButton.svg"); let image: any = button.image; image.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP; image.width = "400px"; diff -ru spa/app_package/src/Playground/HUD.ts spb/app_package/src/Playground/HUD.ts --- spa/app_package/src/Playground/HUD.ts +++ spb/app_package/src/Playground/HUD.ts @@ -41,7 +41,7 @@ adt.addControl(this._fpsCounter); */ for(let i = 0; i < 20; i++) { - var image = new Image("img", assets.assetsHostUrl+"/assets/UI/trackerIcon.svg"); + var image = new Image("img", assets.assetsHostUrl+"assets/UI/trackerIcon.svg"); image.height = "32px"; image.width = "32px"; image.isVisible = false; @@ -50,7 +50,7 @@ image.alpha = 0.4; } - this._targetLock = new Image("img", assets.assetsHostUrl+"/assets/UI/missileLockIcon.svg"); + this._targetLock = new Image("img", assets.assetsHostUrl+"assets/UI/missileLockIcon.svg"); this._targetLock.height = "128px"; this._targetLock.width = "128px"; this._targetLock.sourceWidth = 256; @@ -101,7 +101,7 @@ } adt.addControl(this._statsPanel) - this._statsPanelImage = new Image("statsPanelImage", "/assets/UI/statsPanel.svg"); + this._statsPanelImage = new Image("statsPanelImage", "assets/UI/statsPanel.svg"); this._statsPanelImage.widthInPixels = 300; this._statsPanelImage.heightInPixels = 185; this._statsPanelImage.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER; @@ -128,17 +128,17 @@ this._statsPanel.addControl(this._statsGrid); let size = (InputManager.isTouch) ? 10 : 35; - this._healthIcon = new Image("health", "/assets/UI/healthIcon.svg"); + this._healthIcon = new Image("health", "assets/UI/healthIcon.svg"); this._healthIcon.widthInPixels = size; this._healthIcon.heightInPixels = size; this._statsGrid.addControl(this._healthIcon, 0, 0); - this._speedIcon = new Image("health", "/assets/UI/speedIcon.svg"); + this._speedIcon = new Image("health", "assets/UI/speedIcon.svg"); this._speedIcon.widthInPixels = size; this._speedIcon.heightInPixels = size; this._statsGrid.addControl(this._speedIcon, 1, 0); - this._reloadIcon = new Image("health", "/assets/UI/reloadIcon.svg"); + this._reloadIcon = new Image("health", "assets/UI/reloadIcon.svg"); this._reloadIcon.widthInPixels = size; this._reloadIcon.heightInPixels = size; this._statsGrid.addControl(this._reloadIcon, 2, 0); diff -ru spa/app_package/src/playgroundRunner.ts spb/app_package/src/playgroundRunner.ts --- spa/app_package/src/playgroundRunner.ts +++ spb/app_package/src/playgroundRunner.ts @@ -25,7 +25,7 @@ } else { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); - options.assetsHostUrl = window.location.href.split('?')[0]; + options.assetsHostUrl = window.location.href.split('?')[0].split('#')[0].replace(/\/[^\/]*$/, ''); if (!options.assetsHostUrl) { options.assetsHostUrl = ""; } diff -ru spa/test_package/src/index.js spb/test_package/src/index.js --- spa/test_package/src/index.js +++ spb/test_package/src/index.js @@ -7,14 +7,4 @@ assetsHostUrl = ""; } -// https://blog.typekit.com/2017/09/05/improving-your-web-font-performance/ -(function (d) { - var config = { - kitId: 'njr1oia', - scriptTimeout: 3000, - async: true - }, - h = d.documentElement, t = setTimeout(function () { h.className = h.className.replace(/\bwf-loading\b/g, "") + " wf-inactive"; }, config.scriptTimeout), tk = d.createElement("script"), f = false, s = d.getElementsByTagName("script")[0], a; h.className += " wf-loading"; tk.src = 'https://use.typekit.net/' + config.kitId + '.js'; tk.async = true; tk.onload = tk.onreadystatechange = function () { a = this.readyState; if (f || a && a != "complete" && a != "loaded") return; f = true; clearTimeout(t); try { Typekit.load(config); } catch (e) { } }; s.parentNode.insertBefore(tk, s); -})(document); - initializeBabylonApp({ assetsHostUrl: assetsHostUrl }); \ No newline at end of file diff -ru spa/test_package/webpack.build.config.js spb/test_package/webpack.build.config.js --- spa/test_package/webpack.build.config.js +++ spb/test_package/webpack.build.config.js @@ -10,14 +10,14 @@ watchFiles: ["./src/**/*", "../app_package/lib/**/*"] }, output: { - path: path.resolve(__dirname, "../docs"), + path: path.resolve(__dirname, "../dist"), filename: "bundle.js" }, plugins: [ new DefinePlugin({ DEV_BUILD: JSON.stringify(false) }), - new HtmlWebpackPlugin({ title: "Space Pirates made with Babylon.js" }) + new HtmlWebpackPlugin({ title: "Space Pirates" }) ], module: { rules: [