@next2d/builder 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/electron-config.js +1 -2
- package/docs/steam.md +4 -4
- package/package.json +1 -1
- package/templates/electron/index.js +30 -16
package/dist/electron-config.js
CHANGED
|
@@ -132,8 +132,7 @@ export const createElectronPackagerOptions = (root, config, os, resources) => {
|
|
|
132
132
|
...os === "macos" && (config.macos.localNetworkUsageDescription || config.window.overlay?.enabled) ? {
|
|
133
133
|
"extendInfo": {
|
|
134
134
|
...config.macos.localNetworkUsageDescription ? { "NSLocalNetworkUsageDescription": config.macos.localNetworkUsageDescription } : {},
|
|
135
|
-
// An overlay
|
|
136
|
-
// never shows one. The first instance shows its Dock icon itself (templates/electron/index.js).
|
|
135
|
+
// An overlay is an agent app: no Dock icon, also for a second launch that quits at once.
|
|
137
136
|
...config.window.overlay?.enabled ? { "LSUIElement": true } : {}
|
|
138
137
|
},
|
|
139
138
|
...config.macos.localNetworkUsageDescription ? {
|
package/docs/steam.md
CHANGED
|
@@ -105,9 +105,9 @@ await window.next2dWindow.quit();
|
|
|
105
105
|
const off = window.next2dWindow.onResume(() => { /* 状態の再送など */ });
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
重ね表示が有効なときは、アプリは**1つだけ**起動します(2
|
|
108
|
+
重ね表示が有効なときは、アプリは**1つだけ**起動します(2つ目の起動はすぐに終了します)。macOSではDockにアイコンを出しません(エージェントアプリ。終了はゲーム内のボタンで行います)。開発中に複数起動したいときは `--next2d-allow-multiple` を付けて起動します。
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
Windowsでスリープ(ノートPCのふたを閉じる等)から復帰すると、重ね表示の窓がマウスを受け取れなくなることがあるため、窓を作り直します(ゲームは自動保存を前提にしてください)。電源・ディスプレイ・GPUのイベントは `userData/diagnostics.log`(Windowsは `%APPDATA%\<appId>\diagnostics.log`)に記録されます。
|
|
111
111
|
|
|
112
112
|
Linuxの透明表示はコンポジタが必要です。
|
|
113
113
|
|
|
@@ -327,9 +327,9 @@ await window.next2dWindow.quit();
|
|
|
327
327
|
const off = window.next2dWindow.onResume(() => { /* resend state, etc. */ });
|
|
328
328
|
```
|
|
329
329
|
|
|
330
|
-
With the overlay enabled the app runs **once**: a second launch quits at once
|
|
330
|
+
With the overlay enabled the app runs **once**: a second launch quits at once. On macOS it is an agent app with no Dock icon (quit from inside the game). Start with `--next2d-allow-multiple` to run several copies while developing.
|
|
331
331
|
|
|
332
|
-
|
|
332
|
+
On Windows, after sleep (e.g. closing a laptop lid) the overlay window can stop receiving the mouse, so a fresh window replaces it; the game should save automatically. Power, display and GPU events are logged to `userData/diagnostics.log` (Windows: `%APPDATA%\<appId>\diagnostics.log`).
|
|
333
333
|
|
|
334
334
|
Transparency on Linux requires a compositor.
|
|
335
335
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next2d/builder",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Multi-platform builder for Next2d Framework, supporting export to various platforms such as macOS, Windows, iOS, Android and Web(HTML)",
|
|
5
5
|
"author": "Toshiyuki Ienaga <ienaga@next2d.app>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -76,9 +76,6 @@ const diag = (message) => {
|
|
|
76
76
|
fs.appendFileSync(file, `${new Date().toISOString()} ${message}\n`);
|
|
77
77
|
} catch { /* diagnostics must never break the game */ }
|
|
78
78
|
};
|
|
79
|
-
// After sleep (closing a laptop lid) the GPU is often reset. The renderer then keeps showing its last frame but can
|
|
80
|
-
// no longer draw (the web page is not told), so the pet looks alive and menus never appear. Load the page again to
|
|
81
|
-
// get a fresh GPU device. The game saves automatically, so progress is kept.
|
|
82
79
|
// Counts of mouse events the page really receives (moves are forwarded while click-through; down/up only arrive
|
|
83
80
|
// while the window accepts clicks). Logged when they change, to tell "clicks never reach the page" from other causes.
|
|
84
81
|
const DIAG_SCRIPT = `(() => {
|
|
@@ -103,12 +100,29 @@ const snapshotRenderer = async () => {
|
|
|
103
100
|
diag(`renderer snapshot failed: ${error?.message ?? error}`);
|
|
104
101
|
}
|
|
105
102
|
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
// After sleep (closing a laptop lid) Windows can leave the overlay window itself broken: mouse moves are no longer
|
|
104
|
+
// forwarded to it, or clicks fall through even where the pet is drawn. Reloading the page does not help (the
|
|
105
|
+
// window is the same), so build a new window and close the old one. The game saves automatically, so progress is
|
|
106
|
+
// kept. The new window is created first so the app never has zero windows (which would quit it).
|
|
107
|
+
let recreating = false;
|
|
108
|
+
const recreateWindow = async () => {
|
|
109
|
+
if (recreating || !mainWindow || mainWindow.isDestroyed()) return;
|
|
110
|
+
recreating = true;
|
|
111
|
+
diag("recreate window (resume)");
|
|
112
|
+
const old = mainWindow;
|
|
109
113
|
overlayIgnore = Boolean(overlay?.clickThrough);
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
try {
|
|
115
|
+
await createWindow();
|
|
116
|
+
} catch (error) {
|
|
117
|
+
diag(`recreate window failed: ${error?.message ?? error}`);
|
|
118
|
+
} finally {
|
|
119
|
+
recreating = false;
|
|
120
|
+
if (old !== mainWindow && !old.isDestroyed()) {
|
|
121
|
+
// Closing on purpose: do not treat the old page going away as a crash.
|
|
122
|
+
old.webContents.removeAllListeners("render-process-gone");
|
|
123
|
+
old.destroy();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
112
126
|
};
|
|
113
127
|
const createWindow = async () => {
|
|
114
128
|
const { width, height } = screen.getPrimaryDisplay().workAreaSize;
|
|
@@ -205,9 +219,8 @@ const createWindow = async () => {
|
|
|
205
219
|
|
|
206
220
|
app.whenReady().then(async () => {
|
|
207
221
|
if (!hasLock) return;
|
|
208
|
-
// The overlay app is packaged as an agent app (LSUIElement)
|
|
209
|
-
// the
|
|
210
|
-
if (process.platform === "darwin" && overlay) app.dock?.show();
|
|
222
|
+
// The overlay app is packaged as an agent app (LSUIElement): it never shows a Dock icon (a desktop pet stays out
|
|
223
|
+
// of the Dock and the app switcher; the game offers its own "quit").
|
|
211
224
|
Menu.setApplicationMenu(process.platform === "darwin" ? Menu.buildFromTemplate([
|
|
212
225
|
{ role: "appMenu" }, { role: "editMenu" }, { role: "windowMenu" }
|
|
213
226
|
]) : null);
|
|
@@ -278,11 +291,12 @@ app.whenReady().then(async () => {
|
|
|
278
291
|
for (const name of ["resume", "unlock-screen"]) {
|
|
279
292
|
powerMonitor.on(name, () => {
|
|
280
293
|
diag(name);
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
294
|
+
if (name === "resume" && process.platform === "win32") {
|
|
295
|
+
// Give the GPU/display time to come back, then start over with a fresh window.
|
|
296
|
+
setTimeout(() => { void recreateWindow(); }, 3000);
|
|
297
|
+
} else {
|
|
298
|
+
setTimeout(recoverOverlay, 1000);
|
|
299
|
+
}
|
|
286
300
|
});
|
|
287
301
|
}
|
|
288
302
|
app.on("child-process-gone", (_event, details) => diag(`child-process-gone ${details.type} ${details.reason}`));
|