From 84394668e2ee9a54188e8b7fd8dcc2dc40569f41 Mon Sep 17 00:00:00 2001 From: xharris Date: Wed, 15 Apr 2020 12:26:48 -0400 Subject: [PATCH] working electron-builder configuration --- entry.js | 6 +- entry.less | 1 + ide_game.css | 4 + src/index.html => index.html | 105 +-- package-lock.json | 35 +- package.json | 35 +- projects/test_zone/assets/map/platformer.map | 2 +- projects/test_zone/config.json | 29 +- src/blanke-kit/blanke.js | 6 +- src/entry.less | 1 - src/includes/unsafe-eval.min.js | 9 + src/js/assetmanager.js | 4 +- src/js/exporter.js | 2 +- src/js/gamepreview.js | 818 ++++++++++--------- src/js/sceneeditor.js | 2 +- src/less/font.less | 85 +- src/less/main.less | 6 +- src/main.js | 4 +- 18 files changed, 643 insertions(+), 511 deletions(-) create mode 100644 entry.less create mode 100644 ide_game.css rename src/index.html => index.html (52%) delete mode 100644 src/entry.less create mode 100644 src/includes/unsafe-eval.min.js diff --git a/entry.js b/entry.js index 22ab8735..b5fa470c 100644 --- a/entry.js +++ b/entry.js @@ -1,7 +1,7 @@ -require("update-electron-app")(); +const unhandled = require("electron-unhandled"); +unhandled(); const { app: eApp, BrowserWindow, ipcMain } = require("electron"); -const path = require("path"); const WIN_WIDTH = 1000; const WIN_HEIGHT = 700; @@ -36,7 +36,7 @@ eApp.on("ready", function () { main_window.setWindowButtonVisibility(false); // main_window.webContents.openDevTools(); - main_window.loadFile(path.join(__dirname, "src", "index.html")); + main_window.loadFile("index.html"); main_window.on("close", e => { main_window.webContents.send("close", e); e.preventDefault(); diff --git a/entry.less b/entry.less new file mode 100644 index 00000000..1e171f21 --- /dev/null +++ b/entry.less @@ -0,0 +1 @@ +@import "src/less/main"; diff --git a/ide_game.css b/ide_game.css new file mode 100644 index 00000000..5a87ed5b --- /dev/null +++ b/ide_game.css @@ -0,0 +1,4 @@ +@font-face { + font-family: '04B_03'; + src: url('blankejs/projects/test_zone/04B_03.ttf'); +} diff --git a/src/index.html b/index.html similarity index 52% rename from src/index.html rename to index.html index 2eafe550..0cbdbc52 100644 --- a/src/index.html +++ b/index.html @@ -1,75 +1,80 @@ + + + + - + - + - + - - + + - - - - - + + + + + - - - + + + - - + + - - - - + + + + - + - + - + + - - - - - - + + + + + + - - + + - + - - - - - - - - - - + + + + + + + + + + @@ -89,8 +94,8 @@ logLevel: 0 } - - + + @@ -106,19 +111,19 @@
- - + + - - - + + +
diff --git a/package-lock.json b/package-lock.json index 9e6f3844..b53594d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "BlankE", - "version": "0.1.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -740,6 +740,11 @@ "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", "dev": true }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==" + }, "cli-boxes": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz", @@ -1333,6 +1338,24 @@ } } }, + "electron-unhandled": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/electron-unhandled/-/electron-unhandled-3.0.2.tgz", + "integrity": "sha512-IIqXnM5eNgV7k5sDA/GZ39ygJbpfF3WTArNGQ1TB4AI6ajQuuVztA0M6Mq9uEpmTh5gz4nR+YsTNWYsHLoM5rw==", + "requires": { + "clean-stack": "^2.1.0", + "electron-is-dev": "^1.0.1", + "ensure-error": "^2.0.0", + "lodash.debounce": "^4.0.8" + }, + "dependencies": { + "electron-is-dev": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-1.2.0.tgz", + "integrity": "sha512-R1oD5gMBPS7PVU8gJwH6CtT0e6VSoD0+SzSnYpNm+dBkcijgA+K7VAMHDfnRq/lkKPZArpzplTW6jfiMYosdzw==" + } + } + }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", @@ -1347,6 +1370,11 @@ "once": "^1.4.0" } }, + "ensure-error": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ensure-error/-/ensure-error-2.0.0.tgz", + "integrity": "sha512-1ela4oR5A+TdtFpfiQrZKFUbsOi4JuIYmz2qSGFar6pEdRa54E15mKHVVYrAq1OQhd6b6nVrCaQxQlo6kYwhaw==" + }, "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", @@ -2080,6 +2108,11 @@ "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=" }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=" + }, "lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", diff --git a/package.json b/package.json index 8bb967a3..16aba87d 100644 --- a/package.json +++ b/package.json @@ -12,21 +12,48 @@ "scripts": { "electron": "electron .", "build": "electron-builder", - "dist": "node package.js" + "dist": "node package.js", + "release": "build" }, "build": { "appId": "com.electron.blanke", "win": { - "target": "portable", - "icon": "logo.ico" + "icon": "logo.ico", + "target": [ + "nsis", + "portable" + ], + "publish": [ + "github" + ] + }, + "nsis": { + "oneClick": false, + "allowToChangeInstallationDirectory": true, + "installerIcon": "src/logo.ico", + "installerHeaderIcon": "src/logo.ico" }, "directories": { "buildResources": "src" - } + }, + "files": [ + "index.html", + "entry.js", + "entry.less", + "package.json", + "src/", + "node_modules/" + ], + "extraFiles": [ + "plugins", + "engines", + "themes" + ] }, "dependencies": { "adm-zip": "^0.4.13", "archiver": "^2.1.1", + "electron-unhandled": "^3.0.2", "fs-extra": "^5.0.0", "js-yaml": "^3.13.1", "lodash": "^4.17.15", diff --git a/projects/test_zone/assets/map/platformer.map b/projects/test_zone/assets/map/platformer.map index d49ff71a..0b797f94 100644 --- a/projects/test_zone/assets/map/platformer.map +++ b/projects/test_zone/assets/map/platformer.map @@ -1 +1 @@ -{"objects":{"526dedde":{"198231d8":[["",-16,-16]]},"6457c01e":{"198231d8":[["",-48,-16]]}},"layers":[{"name":"layer0","depth":0,"offset":[0,0],"snap":[32,32],"uuid":"198231d8"}],"images":[{"path":"assets/image/megman.png","snap":[32,32],"offset":[0,0],"spacing":[0,0],"align":"top-left","uuid":"5ee2a97f","coords":{"198231d8":[[-32,32,96,128,32,32,false],[-32,64,96,128,32,32,false],[-32,96,96,128,32,32,false]]}}],"settings":{"camera":[121.23900648638903,462.0467172116109],"last_active_layer":"198231d8","last_object_type":"object","last_object_name":"heart"}} \ No newline at end of file +{"objects":{"526dedde":{"198231d8":[["",-16,-16]]},"6457c01e":{"198231d8":[["",-48,-16]]}},"layers":[{"name":"layer0","depth":0,"offset":[0,0],"snap":[32,32],"uuid":"198231d8"}],"images":[{"path":"assets/image/megman.png","snap":[32,32],"offset":[0,0],"spacing":[0,0],"align":"top-left","uuid":"5ee2a97f","coords":{"198231d8":[[-32,32,96,128,32,32,false],[-32,64,96,128,32,32,false],[-32,96,96,128,32,32,false]]}}],"settings":{"camera":[327.87199930005175,354.58173898382995],"last_active_layer":"198231d8","last_object_type":"object","last_object_name":"heart"}} \ No newline at end of file diff --git a/projects/test_zone/config.json b/projects/test_zone/config.json index 29241df6..81cfded8 100644 --- a/projects/test_zone/config.json +++ b/projects/test_zone/config.json @@ -8,24 +8,24 @@ "window_size": 3, "quick_access": [ [ - "main.lua=script+?", - "main.lua" + "platformer.map=map+?", + "platformer.map" ], [ "platformer.lua=script+?", "platformer.lua" ], [ - "conf.lua=script+?", - "conf.lua" + "Open image editor=?", + "Open image editor" ], [ - "bunnymark.lua=script+?", - "bunnymark.lua" + "View assets=?", + "View assets" ], [ - "ecs.lua=script+state+?", - "ecs.lua" + "main.lua=script+?", + "main.lua" ] ], "autoplay_preview": true, @@ -228,6 +228,19 @@ "spacing": 0, "onion_alpha": 0.3, "image": "image/blue_robot.png" + }, + "image/image5.bmp": { + "frame_size": [ + 256, + 256 + ], + "frames": 1, + "position": [ + 0, + 0 + ], + "spacing": 0, + "onion_alpha": 0.3 } } } \ No newline at end of file diff --git a/src/blanke-kit/blanke.js b/src/blanke-kit/blanke.js index a89c4e4a..24711870 100644 --- a/src/blanke-kit/blanke.js +++ b/src/blanke-kit/blanke.js @@ -869,7 +869,7 @@ class Toast { } set icon(v) { this.el_icon.style.display = "inline-block"; - this.el_icon.data = `icons/${v}.svg`; + this.el_icon.data = `src/icons/${v}.svg`; } set style(v) { let styles = { @@ -905,13 +905,13 @@ var blanke = { createIconButton: function (icon, title) { let el_btn = app.createElement("button", "icon-button"); let el_icon = app.createElement("object", "blanke-icon"); - el_icon.data = "icons/" + icon + ".svg"; + el_icon.data = "src/icons/" + icon + ".svg"; el_icon.type = "image/svg+xml"; el_icon.innerHTML = icon[0].toUpperCase(); el_btn.appendChild(el_icon); el_btn.title = title; el_btn.change = (icon2, title2) => { - el_icon.data = "icons/" + icon2 + ".svg"; + el_icon.data = "src/icons/" + icon2 + ".svg"; el_icon.innerHTML = icon2[0].toUpperCase(); el_btn.title = title2; }; diff --git a/src/entry.less b/src/entry.less deleted file mode 100644 index 3e48f4a5..00000000 --- a/src/entry.less +++ /dev/null @@ -1 +0,0 @@ -@import "less/main"; \ No newline at end of file diff --git a/src/includes/unsafe-eval.min.js b/src/includes/unsafe-eval.min.js new file mode 100644 index 00000000..82e4dc4a --- /dev/null +++ b/src/includes/unsafe-eval.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/unsafe-eval - v5.0.0-rc.2 + * Compiled Wed, 20 Mar 2019 14:35:14 UTC + * + * @pixi/unsafe-eval is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +!function(i){"function"==typeof define&&define.amd?define(i):i()}(function(){"use strict";var i={float:function(i,n,o,f){o!==f&&(o.v=f,i.uniform1f(n,f))},vec2:function(i,n,o,f){o[0]===f[0]&&o[1]===f[1]||(o[0]=f[0],o[1]=f[1],i.uniform2f(n,f[0],f[1]))},vec3:function(i,n,o,f){o[0]===f[0]&&o[1]===f[1]&&o[2]===f[2]||(o[0]=f[0],o[1]=f[1],o[2]=f[2],i.uniform3f(n,f[0],f[1],f[2]))},int:function(i,n,o,f){i.uniform1i(n,f)},ivec2:function(i,n,o,f){i.uniform2i(n,f[0],f[1])},ivec3:function(i,n,o,f){i.uniform3i(n,f[0],f[1],f[2])},ivec4:function(i,n,o,f){i.uniform4i(n,f[0],f[1],f[2],f[3])},bool:function(i,n,o,f){i.uniform1i(n,f)},bvec2:function(i,n,o,f){i.uniform2i(n,f[0],f[1])},bvec3:function(i,n,o,f){i.uniform3i(n,f[0],f[1],f[2])},bvec4:function(i,n,o,f){i.uniform4i(n,f[0],f[1],f[2],f[3])},mat2:function(i,n,o,f){i.uniformMatrix2fv(n,!1,f)},mat3:function(i,n,o,f){i.uniformMatrix3fv(n,!1,f)},mat4:function(i,n,o,f){i.uniformMatrix4fv(n,!1,f)},sampler2D:function(i,n,o,f){i.uniform1i(n,f)},samplerCube:function(i,n,o,f){i.uniform1i(n,f)},sampler2DArray:function(i,n,o,f){i.uniform1i(n,f)}},n={float:function(i,n,o,f){i.uniform1fv(n,f)},vec2:function(i,n,o,f){i.uniform2fv(n,f)},vec3:function(i,n,o,f){i.uniform3fv(n,f)},vec4:function(i,n,o,f){i.uniform4fv(n,f)},int:function(i,n,o,f){i.uniform1iv(n,f)},ivec2:function(i,n,o,f){i.uniform2iv(n,f)},ivec3:function(i,n,o,f){i.uniform3iv(n,f)},ivec4:function(i,n,o,f){i.uniform4iv(n,f)},bool:function(i,n,o,f){i.uniform1iv(n,f)},bvec2:function(i,n,o,f){i.uniform2iv(n,f)},bvec3:function(i,n,o,f){i.uniform3iv(n,f)},bvec4:function(i,n,o,f){i.uniform4iv(n,f)},sampler2D:function(i,n,o,f){i.uniform1iv(n,f)},samplerCube:function(i,n,o,f){i.uniform1iv(n,f)},sampler2DArray:function(i,n,o,f){i.uniform1iv(n,f)}};if(void 0===window.PIXI)throw new Error("Global PIXI not found.");!function(o){if(!o||!o.systems||!o.systems.ShaderSystem)throw new Error("Unable to patch ShaderSystem, class not found.");var f=o.systems.ShaderSystem,t=!1;try{f.prototype.systemCheck.call(null),t=!1}catch(i){t=!0}t&&Object.assign(f.prototype,{systemCheck:function(){},syncUniforms:function(o,f){var t=this.shader,u=this.renderer;!function(o,f,t,u,r){var e=0,c=null,a=null,m=r.gl;for(var v in o.uniforms){var l=f[v],s=u[v],y=t[v],p=o.uniforms[v];l?"float"===l.type&&1===l.size?s!==y.value&&(y.value=s,m.uniform1f(y.location,s)):"sampler2D"!==l.type&&"samplerCube"!==l.type&&"sampler2DArray"!==l.type||1!==l.size||l.isArray?"mat3"===l.type&&1===l.size?void 0!==p.a?m.uniformMatrix3fv(y.location,!1,s.toArray(!0)):m.uniformMatrix3fv(y.location,!1,s):"vec2"===l.type&&1===l.size?void 0!==p.x?(c=s,(a=y.value)[0]===c.x&&a[1]===c.y||(a[0]=c.x,a[1]=c.y,m.uniform2f(y.location,c.x,c.y))):(c=s,(a=y.value)[0]===c[0]&&a[1]===c[1]||(a[0]=c[0],a[1]=c[1],m.uniform2f(y.location,c[0],c[1]))):"vec4"===l.type&&1===l.size?void 0!==p.width?(c=s,(a=y.value)[0]===c.x&&a[1]===c.y&&a[2]===c.width&&a[3]===c.height||(a[0]=c.x,a[1]=c.y,a[2]=c.width,a[3]=c.height,m.uniform4f(y.location,c.x,c.y,c.width,c.height))):(c=s,(a=y.value)[0]===c[0]&&a[1]===c[1]&&a[2]===c[2]&&a[3]===c[3]||(a[0]=c[0],a[1]=c[1],a[2]=c[2],a[3]=c[3],m.uniform4f(y.location,c[0],c[1],c[2],c[3]))):(1===l.size?i:n)[l.type].call(null,m,y.location,y.value,s):(r.texture.bind(s,e),y.value!==e&&(y.value=e,m.uniform1i(y.location,e)),e++):p.group&&r.shader.syncUniformGroup(s)}}(o,t.program.uniformData,f.uniformData,o.uniforms,u)}})}(window.PIXI)}); +//# sourceMappingURL=unsafe-eval.min.js.map \ No newline at end of file diff --git a/src/js/assetmanager.js b/src/js/assetmanager.js index fd452f3c..187bbc51 100644 --- a/src/js/assetmanager.js +++ b/src/js/assetmanager.js @@ -161,7 +161,7 @@ class AssetManager extends Editor { }; el_image.src = "file://" + path; } else { - /* + /* else if (file_type == 'audio') { }*/ @@ -264,7 +264,7 @@ class AssetManager extends Editor { // delete button let el_delete = app.createElement("button", "ui-button-sphere"); - el_delete.innerHTML = ``; + el_delete.innerHTML = ``; el_delete.addEventListener("click", function () { blanke.showModal("delete '" + nwPATH.basename(old_path) + "'?", { yes: function () { diff --git a/src/js/exporter.js b/src/js/exporter.js index 0bd1e5d2..3503d98e 100644 --- a/src/js/exporter.js +++ b/src/js/exporter.js @@ -43,7 +43,7 @@ class Exporter extends Editor { let el_platform_icon = app.createElement("object"); el_platform_icon.type = "image/svg+xml"; - el_platform_icon.data = "icons/" + platform + ".svg"; + el_platform_icon.data = "src/icons/" + platform + ".svg"; el_platform_container.value = platform; el_platform_container.addEventListener("click", function (e) { diff --git a/src/js/gamepreview.js b/src/js/gamepreview.js index f5ff3be8..49a81439 100644 --- a/src/js/gamepreview.js +++ b/src/js/gamepreview.js @@ -47,7 +47,7 @@ var infiniteLoopDetector = (function() { }()) `; -const SHADER_ERR = '[Shader]'; +const SHADER_ERR = "[Shader]"; let re_scene_name = /\bScene\s*\(\s*[\'\"](.+)[\'\"]/; let re_new_line = /(\r\n|\r|\n)/g; @@ -55,169 +55,164 @@ let re_error_line = /:(\d+):(\d+)\)/; let re_shader_error = /ERROR: \d+:(\d+): (.*)/; class GamePreview { - constructor (parent, opt) { - let this_ref = this; - - this.game = null; - this.container = app.createElement("div","game-preview-container"); - this.iframe = app.createElement("iframe"); - this.id = "game-"+guid(); - this.iframe.id = this.id; - this.parent = parent || document.createDocumentFragment(); - this.line_ranges = {}; - this.size = 0; - this.breakpoints = []; - - this.options = ifndef_obj(opt, { - ide_mode: true, - scene: null, - size: null, - onLoad: null - }); - - // engine loaded - this.refresh_file = null; - this.clearErrors(); - this.last_code = null; - this.iframe.addEventListener('load', () => { - let iframe = this.iframe; - let doc = iframe.contentDocument; - let canvas = doc.querySelectorAll("#game canvas"); - canvas.forEach(el => el.remove()); - if (this.error_status == 'error') { - this.reportError(...this.errored) - return; - } - if (this.refresh_file && this.error_status == 'none') - this.refreshSource(this.refresh_file); - if (this.options.onLoad) - this.options.onLoad(this); - - if (this.onLog) { - let old_console = iframe.contentWindow.console; - iframe.contentWindow.console = { - error: (...args) => { - this.reportError(args[0], SHADER_ERR) - old_console.error(...args) - }, - warn: (...args) => { - old_console.warn(...args) - }, - log: (...args) => { - this.onLog(...args) - //old_log(...args); - }, - superlog: (...args) => { - console.log(...args); - } - } - } - - if (this.last_code) { - let old_script = doc.querySelectorAll('script.source'); - if (old_script) - old_script.forEach((el) => el.remove()); - let parent= doc.getElementsByTagName('body')[0]; - let script= doc.createElement('script'); - script.classList.add("source"); - iframe.onerror = this.reportError.bind(this); - iframe.contentWindow.onerror = this.reportError.bind(this); - script.innerHTML= this.last_code; - parent.appendChild(script); - this.last_code = null; - } - this.game = this.iframe.contentWindow.game_instance; - if (this.game) { - this.game.Game.onPause = ()=>{ - this.game_checkpaused(); - } - if (this.error_status == 'resolving') { - this.error_status = 'none'; - if (this.onErrorResolved) { - this.onErrorResolved(); - } - } - } - this.game_checkpaused(); - if (this.onRefresh) this.onRefresh(); - this.iframe.style.display = 'initial'; - }) - this.refreshSource(); - this.parent.appendChild(this.iframe); - - this.paused = false; - document.addEventListener('engineChange',(e)=>{ - if (!this.paused || this.errored) - this.refreshSource(this.last_script); - }); - - // game controls - this.el_control_bar = app.createElement("div","control-bar"); - - this.el_refresh = app.createIconButton("refresh","refresh"); - this.el_refresh.addEventListener('click',()=>{ - if (this.onRefreshButton) this.onRefreshButton(); - this.clearErrors(); - this.refreshSource(this.last_script); - }); - this.el_control_bar.appendChild(this.el_refresh); - this.el_pauseplay = app.createIconButton("pause","pause"); - this.el_pauseplay.addEventListener('click',()=>{ - this.game_paused() ? this.game_resume() : this.game_pause(); - this.game_checkpaused(); - }); - this.el_control_bar.appendChild(this.el_pauseplay); - this.el_step = app.createIconButton("step","next frame"); - this.el_step.addEventListener('click',()=>{ - this.game_step(); - }); - this.el_control_bar.appendChild(this.el_step); - - this.container.appendChild(this.iframe); - this.container.appendChild(this.el_control_bar); - } + constructor(parent, opt) { + let this_ref = this; + + this.game = null; + this.container = app.createElement("div", "game-preview-container"); + this.iframe = app.createElement("iframe"); + this.id = "game-" + guid(); + this.iframe.id = this.id; + this.parent = parent || document.createDocumentFragment(); + this.line_ranges = {}; + this.size = 0; + this.breakpoints = []; + + this.options = ifndef_obj(opt, { + ide_mode: true, + scene: null, + size: null, + onLoad: null, + }); + + // engine loaded + this.refresh_file = null; + this.clearErrors(); + this.last_code = null; + this.iframe.addEventListener("load", () => { + let iframe = this.iframe; + let doc = iframe.contentDocument; + let canvas = doc.querySelectorAll("#game canvas"); + canvas.forEach(el => el.remove()); + if (this.error_status == "error") { + this.reportError(...this.errored); + return; + } + if (this.refresh_file && this.error_status == "none") + this.refreshSource(this.refresh_file); + if (this.options.onLoad) this.options.onLoad(this); + + if (this.onLog) { + let old_console = iframe.contentWindow.console; + iframe.contentWindow.console = { + error: (...args) => { + this.reportError(args[0], SHADER_ERR); + old_console.error(...args); + }, + warn: (...args) => { + old_console.warn(...args); + }, + log: (...args) => { + this.onLog(...args); + //old_log(...args); + }, + superlog: (...args) => { + console.log(...args); + }, + }; + } - get width () { - if (this.game) return this.game.Game.width; - } + if (this.last_code) { + let old_script = doc.querySelectorAll("script.source"); + if (old_script) old_script.forEach(el => el.remove()); + let parent = doc.getElementsByTagName("body")[0]; + let script = doc.createElement("script"); + script.classList.add("source"); + iframe.onerror = this.reportError.bind(this); + iframe.contentWindow.onerror = this.reportError.bind(this); + script.innerHTML = this.last_code; + parent.appendChild(script); + this.last_code = null; + } + this.game = this.iframe.contentWindow.game_instance; + if (this.game) { + this.game.Game.onPause = () => { + this.game_checkpaused(); + }; + if (this.error_status == "resolving") { + this.error_status = "none"; + if (this.onErrorResolved) { + this.onErrorResolved(); + } + } + } + this.game_checkpaused(); + if (this.onRefresh) this.onRefresh(); + this.iframe.style.display = "initial"; + }); + this.refreshSource(); + this.parent.appendChild(this.iframe); + + this.paused = false; + document.addEventListener("engineChange", e => { + if (!this.paused || this.errored) this.refreshSource(this.last_script); + }); + + // game controls + this.el_control_bar = app.createElement("div", "control-bar"); + + this.el_refresh = app.createIconButton("refresh", "refresh"); + this.el_refresh.addEventListener("click", () => { + if (this.onRefreshButton) this.onRefreshButton(); + this.clearErrors(); + this.refreshSource(this.last_script); + }); + this.el_control_bar.appendChild(this.el_refresh); + this.el_pauseplay = app.createIconButton("pause", "pause"); + this.el_pauseplay.addEventListener("click", () => { + this.game_paused() ? this.game_resume() : this.game_pause(); + this.game_checkpaused(); + }); + this.el_control_bar.appendChild(this.el_pauseplay); + this.el_step = app.createIconButton("step", "next frame"); + this.el_step.addEventListener("click", () => { + this.game_step(); + }); + this.el_control_bar.appendChild(this.el_step); + + this.container.appendChild(this.iframe); + this.container.appendChild(this.el_control_bar); + } - get height () { - if (this.game) return this.game.Game.height; - } - game_checkpaused () { - if (this.game_paused()) - this.el_pauseplay.change('run','resume preview'); - else - this.el_pauseplay.change('pause','pause preview'); - } - game_paused () { return this.game ? this.game.Game.paused : null; } - game_pause () { - if (this.game) this.game.Game.pause(); - } - game_resume () { - if (this.game) this.game.Game.resume(); - } - game_step () { - if (this.game) this.game.Game.step(); - } - pause () { - this.paused = true; - if (this.game) - this.game.Game.freeze(); - } - resume () { - this.paused = false; - if (this.game && !this.errored) - this.game.Game.unfreeze(); - } + get width() { + if (this.game) return this.game.Game.width; + } - getAssets () { - let str_assets = []; + get height() { + if (this.game) return this.game.Game.height; + } + game_checkpaused() { + if (this.game_paused()) this.el_pauseplay.change("run", "resume preview"); + else this.el_pauseplay.change("pause", "pause preview"); + } + game_paused() { + return this.game ? this.game.Game.paused : null; + } + game_pause() { + if (this.game) this.game.Game.pause(); + } + game_resume() { + if (this.game) this.game.Game.resume(); + } + game_step() { + if (this.game) this.game.Game.step(); + } + pause() { + this.paused = true; + if (this.game) this.game.Game.freeze(); + } + resume() { + this.paused = false; + if (this.game && !this.errored) this.game.Game.unfreeze(); + } - } + getAssets() { + let str_assets = []; + } - getSource () { - return GamePreview.getHTML(` + getSource() { + return GamePreview.getHTML( + `
@@ -240,54 +235,60 @@ class GamePreview { scale: ${this.options.ide_mode || app.projSetting("export").scale}, width: ${this.options.size[0]}, height: ${this.options.size[1]}, - ${this.options.resizable ? 'resizable: true,' : '' } + ${this.options.resizable ? "resizable: true," : ""} assets: [${this.getAssetStr()}], onLoad: function(){ ${this.refreshSource()} } }); - `, this.options.ide_mode); - } + `, + this.options.ide_mode + ); + } - getAssetStr () { - let ret = ` + getAssetStr() { + let ret = ` ["config.json"], - ${app.asset_list.reduce((arr, val) => { - if (val.includes('assets')) - arr.push(`["assets/${app.shortenAsset(val)}"]`) - return arr; - },[]).join(',\n\t\t\t\t\t')} + ${app.asset_list + .reduce((arr, val) => { + if (val.includes("assets")) + arr.push(`["assets/${app.shortenAsset(val)}"]`); + return arr; + }, []) + .join(",\n\t\t\t\t\t")} `; - return ret; - } + return ret; + } - static getScriptOrder (curr_script) { - let scripts = []; - let curr_script_cat = 'other'; - let found = false; - for (let cat of ['other','entity','scene']) { - if (Array.isArray(Code.scripts[cat])) { - // put current_script at end - scripts = scripts.concat(Code.scripts[cat].filter(val => { - if (val == curr_script) { - found = true; - curr_script_cat = cat; - } - return (!curr_script || val != curr_script) && !scripts.includes(val); - })); - } - } - if (found) - scripts.push(curr_script); - if (curr_script) - return [ scripts, curr_script_cat ]; - return scripts; - } + static getScriptOrder(curr_script) { + let scripts = []; + let curr_script_cat = "other"; + let found = false; + for (let cat of ["other", "entity", "scene"]) { + if (Array.isArray(Code.scripts[cat])) { + // put current_script at end + scripts = scripts.concat( + Code.scripts[cat].filter(val => { + if (val == curr_script) { + found = true; + curr_script_cat = cat; + } + return ( + (!curr_script || val != curr_script) && !scripts.includes(val) + ); + }) + ); + } + } + if (found) scripts.push(curr_script); + if (curr_script) return [scripts, curr_script_cat]; + return scripts; + } - getExtraEngineCode () { - // TODO: take another look at this. game viewport is cutoff - if (this.options.ide_mode) { - return ` + getExtraEngineCode() { + // TODO: take another look at this. game viewport is cutoff + if (this.options.ide_mode) { + return ` let TestScene = (funcs) => { Scene("_test", funcs); } @@ -315,167 +316,171 @@ class GamePreview { } }); `; - } - return ` + } + return ` let TestScene = () => {}; let TestView = () => {}; `; - } + } - reportError (msg, url, lineNo, columnNo, error) { - if (!msg || this.errored) return; - let shader_err = (url === SHADER_ERR) ? url : null; - this.pause(); - this.errored = [msg, url, lineNo, columnNo, error]; - this.error_status = 'error'; - // get line and col - if (!shader_err) { - let match = re_error_line.exec(error.stack); - if (match) { - lineNo = parseInt(match[1]); - columnNo = parseInt(match[2]); - } - } - msg = msg.replace("Uncaught Error: ",""); - if (this.onError) { - let file, range; - if (shader_err) { - let match = re_shader_error.exec(msg) - if (match) { - this.onError(match[2], shader_err, match[1], '-'); - } - } else { - for (let f in this.line_ranges) { - range = this.line_ranges[f]; - if (lineNo > range.start && lineNo < range.end) { - file = f; - break; - } - } - if (file) - this.onError(msg, file, lineNo - range.start, columnNo); - } - } - console.log("(Engine Error) "+msg, url, lineNo, columnNo, error) - return true; - } + reportError(msg, url, lineNo, columnNo, error) { + if (!msg || this.errored) return; + let shader_err = url === SHADER_ERR ? url : null; + this.pause(); + this.errored = [msg, url, lineNo, columnNo, error]; + this.error_status = "error"; + // get line and col + if (!shader_err) { + let match = re_error_line.exec(error.stack); + if (match) { + lineNo = parseInt(match[1]); + columnNo = parseInt(match[2]); + } + } + msg = msg.replace("Uncaught Error: ", ""); + if (this.onError) { + let file, range; + if (shader_err) { + let match = re_shader_error.exec(msg); + if (match) { + this.onError(match[2], shader_err, match[1], "-"); + } + } else { + for (let f in this.line_ranges) { + range = this.line_ranges[f]; + if (lineNo > range.start && lineNo < range.end) { + file = f; + break; + } + } + if (file) this.onError(msg, file, lineNo - range.start, columnNo); + } + } + console.log("(Engine Error) " + msg, url, lineNo, columnNo, error); + return true; + } - clearErrors () { - this.error_status = 'resolving'; - this.errored = false; - } - - refreshSource (current_script) { - this.iframe.style.display = 'none'; - this.last_script = current_script; - if (!this.game) - this.refresh_file = app.cleanPath(current_script); - if (this.refresh_file && !current_script) { - current_script = this.refresh_file - this.refresh_file = null; - } - if (this.error_status == 'error') - return; - //if (this.game) - //this.game.Game.end(); - - let post_load = ''; - // get all the scripts - let scripts = []; - let curr_script_cat = 'other'; - let contains_test_scene = false; - - if (current_script && nwFS.pathExistsSync(current_script)) { - [ scripts, curr_script_cat ] = GamePreview.getScriptOrder(current_script); - let file_data = nwFS.readFileSync(current_script,'utf-8'); - contains_test_scene = file_data.includes('TestScene({') - } else - scripts = GamePreview.getScriptOrder() - switch (curr_script_cat) { - case 'entity': - if (this.options.ide_mode && contains_test_scene) - post_load += '\nScene.start("_test");\n'; - break; - case 'scene': - let match = re_scene_name.exec(nwFS.readFileSync(current_script,'utf-8')); - if (match && match.length > 1) { - if (contains_test_scene) - post_load += '\nScene.start("_test");\n'; - else { - post_load += `\nScene.start("${match[1]}");\n`; - } - } - break; - case 'other': - if (contains_test_scene) - post_load += '\nScene.start("_test");\n'; - else if (this.options.scene) { - post_load += '\nScene.start("'+this.options.scene+'");\n'; - } - break; - } + clearErrors() { + this.error_status = "resolving"; + this.errored = false; + } + + refreshSource(current_script) { + this.iframe.style.display = "none"; + this.last_script = current_script; + if (!this.game) this.refresh_file = app.cleanPath(current_script); + if (this.refresh_file && !current_script) { + current_script = this.refresh_file; + this.refresh_file = null; + } + if (this.error_status == "error") return; + //if (this.game) + //this.game.Game.end(); + + let post_load = ""; + // get all the scripts + let scripts = []; + let curr_script_cat = "other"; + let contains_test_scene = false; + + if (current_script && nwFS.pathExistsSync(current_script)) { + [scripts, curr_script_cat] = GamePreview.getScriptOrder(current_script); + let file_data = nwFS.readFileSync(current_script, "utf-8"); + contains_test_scene = file_data.includes("TestScene({"); + } else scripts = GamePreview.getScriptOrder(); + switch (curr_script_cat) { + case "entity": + if (this.options.ide_mode && contains_test_scene) + post_load += '\nScene.start("_test");\n'; + break; + case "scene": + let match = re_scene_name.exec( + nwFS.readFileSync(current_script, "utf-8") + ); + if (match && match.length > 1) { + if (contains_test_scene) post_load += '\nScene.start("_test");\n'; + else { + post_load += `\nScene.start("${match[1]}");\n`; + } + } + break; + case "other": + if (contains_test_scene) post_load += '\nScene.start("_test");\n'; + else if (this.options.scene) { + post_load += '\nScene.start("' + this.options.scene + '");\n'; + } + break; + } - // wrapped in a function so local variables are destroyed on reload - let onload_code = ` + // wrapped in a function so local variables are destroyed on reload + let onload_code = ` let { ${GamePreview.engine_classes} } = game_instance; ${this.getExtraEngineCode()}\n`; - let code = ` + let code = ` var game_instance; game_instance = Blanke("#game",{ config: ${JSON.stringify(app.projSetting())}, ide_mode: true, - ${this.options.size == null ? - `scale: true,` - : - `width: ${this.options.size[0]}, + ${ + this.options.size == null + ? `scale: true,` + : `width: ${this.options.size[0]}, height: ${this.options.size[1]},` - } - root: '${app.cleanPath(nwPATH.relative("src",nwPATH.join(app.project_path)))}', + } + root: '${app.cleanPath(nwPATH.relative("src", nwPATH.join(app.project_path)))}', assets: [${this.getAssetStr()}], onLoad: function(classes){ let { ${GamePreview.engine_classes} } = classes; ${this.getExtraEngineCode()}\n`; - this.line_ranges = {}; - let line_offset = 22; // compensates for line 308 where extra code is added; - let last_line_end = (code.match(re_new_line) || []).length + line_offset; - for (let path of scripts) { - if (nwFS.pathExistsSync(path)) { - let file_data = nwFS.readFileSync(path,'utf-8') + '\n'; - // breakpoints - if (path == current_script) { - let lines = file_data.split('\n') - this.breakpoints.forEach((l)=>{ - lines[l] = '(()=>{Game.pause();})();'+lines[l]; - // lines.splice(l,0,'Game.pause()'); - }) - code += lines.join('\n'); - } else - code += file_data; - onload_code += nwFS.readFileSync(path,'utf-8') + '\n'; - // get the lines at which this piece of code starts and ends - this.line_ranges[path] = { - start: last_line_end, - end: (code.match(re_new_line) || []).length + line_offset - }; - - last_line_end = this.line_ranges[path].end; - } - } - onload_code += (post_load || ''); - code += (post_load || '') + ` + this.line_ranges = {}; + let line_offset = 22; // compensates for line 308 where extra code is added; + let last_line_end = (code.match(re_new_line) || []).length + line_offset; + for (let path of scripts) { + if (nwFS.pathExistsSync(path)) { + let file_data = nwFS.readFileSync(path, "utf-8") + "\n"; + // breakpoints + if (path == current_script) { + let lines = file_data.split("\n"); + this.breakpoints.forEach(l => { + lines[l] = "(()=>{Game.pause();})();" + lines[l]; + // lines.splice(l,0,'Game.pause()'); + }); + code += lines.join("\n"); + } else code += file_data; + onload_code += nwFS.readFileSync(path, "utf-8") + "\n"; + // get the lines at which this piece of code starts and ends + this.line_ranges[path] = { + start: last_line_end, + end: (code.match(re_new_line) || []).length + line_offset, + }; + + last_line_end = this.line_ranges[path].end; + } + } + onload_code += post_load || ""; + code += + (post_load || "") + + ` - ${app.projSetting("autoplay_preview") && this.options.ide_mode ? '' : 'Game.pause();Game.step();'} + ${ + app.projSetting("autoplay_preview") && this.options.ide_mode + ? "" + : "Game.pause();Game.step();" + } } });`; - this.iframe.srcdoc = GamePreview.getHTML(` + this.iframe.srcdoc = GamePreview.getHTML( + `
`, this.options.ide_mode); + `, + this.options.ide_mode + ); - this.last_code = ` + this.last_code = ` let app = window.parent.app; window.addEventListener('dragover', function(e) { e.preventDefault(); @@ -500,18 +505,17 @@ game_instance = Blanke("#game",{ ${code} `; - return onload_code; - } - - setSourceFile (file) { - this.last_script = file; - if (!this.paused) - this.refreshSource(this.last_script); - } + return onload_code; + } + + setSourceFile(file) { + this.last_script = file; + if (!this.paused) this.refreshSource(this.last_script); + } } -GamePreview.engine_classes = ''; +GamePreview.engine_classes = ""; GamePreview.getHTML = (body, ide_mode, engine_path) => { - return ` + return ` - - ${engine_path ? - `` : - `` - } + + ${ + engine_path + ? `` + : `` + }
${font_families.map(v => `\n`)}
${body} - `}; + `; +}; let font_families = []; let writeGameCSS = () => { - // create css file with font-face - let css_str = ''; - let css_ide_str = ''; - app.getAssets('font', (files)=>{ - for (let f of files) { - let name = nwPATH.parse(f).name - font_families.push(name); -css_str+=`@font-face { + // create css file with font-face + let css_str = ""; + let css_ide_str = ""; + app.getAssets("font", files => { + for (let f of files) { + let name = nwPATH.parse(f).name; + font_families.push(name); + (css_str += `@font-face { font-family: '${name}'; - src: url('${(name == '04B_03' ? '' : 'font/') + app.shortenAsset(f)}'); -}\n`,'utf-8' -css_ide_str+=`@font-face { + src: url('${(name == "04B_03" ? "" : "font/") + app.shortenAsset(f)}'); +}\n`), + "utf-8"; + (css_ide_str += `@font-face { font-family: '${name}'; - src: url('${app.cleanPath(nwPATH.relative('',app.project_path))}/${(name == '04B_03' ? '' : 'font/') + app.shortenAsset(f)}'); -}\n`,'utf-8' - } - // replace ide game.css - nwFS.writeFileSync(nwPATH.join(app.project_path, 'game.css'), css_str, 'utf-8'); - nwFS.writeFileSync(nwPATH.join(__dirname,'/ide_game.css'), css_ide_str, 'utf-8'); - let link = document.getElementById("game-css"); - if (link) { - link.href = 'ide_game.css'; - } - // add game.css if not already added - else { - link = document.createElement('link'); - link.id = "game-css"; - link.rel = 'stylesheet'; - link.type = 'text/css'; - link.href = 'ide_game.css'; - link.media = 'all'; - document.head.appendChild(link); - } - // add font preload element - let el_preload = document.getElementById("font-preload"); - if (!el_preload) { - el_preload = document.createElement('div'); - document.head.appendChild(el_preload); - } - el_preload.id = "font-preload"; - el_preload.style.opacity = 0; - el_preload.innerHTML = font_families.map(v => `\n`).join('\n'); - }); -} - -document.addEventListener("openProject",(e)=>{ - writeGameCSS(); + src: url('${app.cleanPath(nwPATH.relative("", app.project_path))}/${ + (name == "04B_03" ? "" : "font/") + app.shortenAsset(f) + }'); +}\n`), + "utf-8"; + } + // replace ide game.css + nwFS.writeFileSync( + nwPATH.join(app.project_path, "game.css"), + css_str, + "utf-8" + ); + nwFS.writeFileSync( + nwPATH.join(__dirname, "/ide_game.css"), + css_ide_str, + "utf-8" + ); + let link = document.getElementById("game-css"); + if (link) { + link.href = "ide_game.css"; + } + // add game.css if not already added + else { + link = document.createElement("link"); + link.id = "game-css"; + link.rel = "stylesheet"; + link.type = "text/css"; + link.href = "ide_game.css"; + link.media = "all"; + document.head.appendChild(link); + } + // add font preload element + let el_preload = document.getElementById("font-preload"); + if (!el_preload) { + el_preload = document.createElement("div"); + document.head.appendChild(el_preload); + } + el_preload.id = "font-preload"; + el_preload.style.opacity = 0; + el_preload.innerHTML = font_families + .map(v => `\n`) + .join("\n"); + }); +}; + +document.addEventListener("openProject", e => { + // writeGameCSS(); }); -document.addEventListener('asset_added', (e)=>{ - let info = e.detail; // {type: res_type, path: asset_path} - if (info.res_type == 'font') - writeGameCSS(); +document.addEventListener("asset_added", e => { + let info = e.detail; // {type: res_type, path: asset_path} + if (info.res_type == "font"); + // writeGameCSS(); }); diff --git a/src/js/sceneeditor.js b/src/js/sceneeditor.js index 7a624087..6071f436 100644 --- a/src/js/sceneeditor.js +++ b/src/js/sceneeditor.js @@ -33,7 +33,7 @@ function sendToBack(sprite, parent) { } } -PIXI.Loader.shared.add("ProggyScene", "includes/proggy_scene.fnt"); +PIXI.Loader.shared.add("ProggyScene", "src/includes/proggy_scene.fnt"); PIXI.Loader.shared.load(); let map_folder = () => nwPATH.join(app.project_path, "assets", "maps"); diff --git a/src/less/font.less b/src/less/font.less index 7289fad0..1f5dc687 100644 --- a/src/less/font.less +++ b/src/less/font.less @@ -1,59 +1,74 @@ /* ProggyVector */ @font-face { - font-family: 'ProggyVector'; - src: url('includes/proggyfonts-1.1.0/ProggyVector/ProggyVector Regular.ttf') format('truetype'); + font-family: "ProggyVector"; + src: url("src/includes/proggyfonts-1.1.0/ProggyVector/ProggyVector Regular.ttf") + format("truetype"); } /* ProggySquare */ @font-face { - font-family: 'ProggySquare'; - src: url('includes/ProggySquareSZ.ttf') format('truetype'); + font-family: "ProggySquare"; + src: url("src/includes/ProggySquareSZ.ttf") format("truetype"); unicode-range: U+20-7E; } /* Mononoki */ @font-face { - font-family: 'Mononoki'; - src: url('includes/mononoki/mononoki-Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url('includes/mononoki/mononoki-Regular.woff2') format('woff2'), /* Super Modern Browsers */ - url('includes/mononoki/mononoki-Regular.woff') format('woff'), /* Pretty Modern Browsers */ - url('includes/mononoki/mononoki-Regular.ttf') format('truetype'); /* Safari, Android, iOS */ - font-weight: normal; - font-style: normal; + font-family: "Mononoki"; + src: url("src/includes/mononoki/mononoki-Regular.eot?#iefix") + format("embedded-opentype"), + /* IE6-IE8 */ url("src/includes/mononoki/mononoki-Regular.woff2") + format("woff2"), + /* Super Modern Browsers */ + url("src/includes/mononoki/mononoki-Regular.woff") format("woff"), + /* Pretty Modern Browsers */ + url("src/includes/mononoki/mononoki-Regular.ttf") format("truetype"); /* Safari, Android, iOS */ + font-weight: normal; + font-style: normal; } @font-face { - font-family: 'Mononoki'; - src: url('includes/mononoki/mononoki-Bold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url('includes/mononoki/mononoki-Bold.woff2') format('woff2'), /* Super Modern Browsers */ - url('includes/mononoki/mononoki-Bold.woff') format('woff'), /* Pretty Modern Browsers */ - url('includes/mononoki/mononoki-Bold.ttf') format('truetype'); /* Safari, Android, iOS */ - font-weight: bold; - font-style: normal; + font-family: "Mononoki"; + src: url("src/includes/mononoki/mononoki-Bold.eot?#iefix") + format("embedded-opentype"), + /* IE6-IE8 */ url("src/includes/mononoki/mononoki-Bold.woff2") + format("woff2"), + /* Super Modern Browsers */ url("src/includes/mononoki/mononoki-Bold.woff") + format("woff"), + /* Pretty Modern Browsers */ url("src/includes/mononoki/mononoki-Bold.ttf") + format("truetype"); /* Safari, Android, iOS */ + font-weight: bold; + font-style: normal; } @font-face { - font-family: 'Mononoki'; - src: url('includes/mononoki/mononoki-Italic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url('includes/mononoki/mononoki-Italic.woff2') format('woff2'), /* Super Modern Browsers */ - url('includes/mononoki/mononoki-Italic.woff') format('woff'), /* Pretty Modern Browsers */ - url('includes/mononoki/mononoki-Italic.ttf') format('truetype'); /* Safari, Android, iOS */ - font-weight: normal; - font-style: italic; - + font-family: "Mononoki"; + src: url("src/includes/mononoki/mononoki-Italic.eot?#iefix") + format("embedded-opentype"), + /* IE6-IE8 */ url("src/includes/mononoki/mononoki-Italic.woff2") + format("woff2"), + /* Super Modern Browsers */ + url("src/includes/mononoki/mononoki-Italic.woff") format("woff"), + /* Pretty Modern Browsers */ + url("src/includes/mononoki/mononoki-Italic.ttf") format("truetype"); /* Safari, Android, iOS */ + font-weight: normal; + font-style: italic; } @font-face { - font-family: 'Mononoki'; - src: url('includes/mononoki/mononoki-BoldItalic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url('includes/mononoki/mononoki-BoldItalic.woff2') format('woff2'), /* Super Modern Browsers */ - url('includes/mononoki/mononoki-BoldItalic.woff') format('woff'), /* Pretty Modern Browsers */ - url('includes/mononoki/mononoki-BoldItalic.ttf') format('truetype'); /* Safari, Android, iOS */ - font-weight: bold; - font-style: italic; + font-family: "Mononoki"; + src: url("src/includes/mononoki/mononoki-BoldItalic.eot?#iefix") + format("embedded-opentype"), + /* IE6-IE8 */ url("src/includes/mononoki/mononoki-BoldItalic.woff2") + format("woff2"), + /* Super Modern Browsers */ + url("src/includes/mononoki/mononoki-BoldItalic.woff") format("woff"), + /* Pretty Modern Browsers */ + url("src/includes/mononoki/mononoki-BoldItalic.ttf") format("truetype"); /* Safari, Android, iOS */ + font-weight: bold; + font-style: italic; } - /* Sudo @font-face { font-family: 'Sudo'; @@ -105,4 +120,4 @@ url('includes/FiraCode2/woff/FiraCode-VF.woff') format('woff-variations'); font-weight: 300 700; font-style: normal; - } */ \ No newline at end of file + } */ diff --git a/src/less/main.less b/src/less/main.less index ccb0c5e3..0ad04ba4 100644 --- a/src/less/main.less +++ b/src/less/main.less @@ -1159,7 +1159,7 @@ iframe { width: 200px; height: 200px; left: 50%; - background: url("logo.png"); + background: url("src/logo.png"); background-size: 100%; transform: scale(4) translate(25%, -12.5%); image-rendering: pixelated; @@ -1167,7 +1167,7 @@ iframe { &::before { content: ""; - background: url(logo.png) no-repeat; + background: url(src/logo.png) no-repeat; width: 200px; height: 200px; background-size: 200px 200px; @@ -1688,7 +1688,7 @@ select option.placeholder { border-radius: 0px; -webkit-border-radius: 0px; -webkit-appearance: none; - background-image: url(icons/chevron_down.svg); + background-image: url(src/icons/chevron_down.svg); background-position: 100% 25%; background-repeat: no-repeat; padding-right: 26px; diff --git a/src/main.js b/src/main.js index e26a622f..1d7b17c6 100644 --- a/src/main.js +++ b/src/main.js @@ -27,7 +27,7 @@ var nwWALK = require("walk"); var nwPATH = require("path"); var nwOS = require("os"); const { cwd } = require("process"); -var nwNOOB = require("./js/server.js"); +var nwNOOB = require(`${__dirname}/src/js/server.js`); var nwZIP2 = require("adm-zip"); // used for unzipping var nwWATCH = require("node-watch"); var nwREQ = require("request"); @@ -1325,6 +1325,8 @@ var app = { curr_version: "", checkForUpdates(silent) { + return; + let curr_version_list = JSON.parse( nwFS.readFileSync(nwPATH.join("src", "version.json")) );