Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/steam.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ await window.next2dWindow.quit();
const off = window.next2dWindow.onResume(() => { /* 状態の再送など */ });
```

重ね表示が有効なときは、アプリは**1つだけ**起動します(2つ目の起動はすぐに終了します。macOSではDockにアイコンも出しません)。開発中に複数起動したいときは `--next2d-allow-multiple` を付けて起動します。
重ね表示が有効なときは、アプリは**1つだけ**起動します(2つ目の起動はすぐに終了します)。macOSではDockにアイコンを出しません(エージェントアプリ。終了はゲーム内のボタンで行います)。開発中に複数起動したいときは `--next2d-allow-multiple` を付けて起動します。

スリープ(ノートPCのふたを閉じる等)から復帰すると、GPUがリセットされて描画が止まることがあるため、画面(renderer)を読み込み直します(ゲームは自動保存を前提にしてください)。電源・ディスプレイ・GPUのイベントは `userData/diagnostics.log`(Windowsは `%APPDATA%\<appId>\diagnostics.log`)に記録されます。

Expand Down Expand Up @@ -327,7 +327,7 @@ await window.next2dWindow.quit();
const off = window.next2dWindow.onResume(() => { /* resend state, etc. */ });
```

With the overlay enabled the app runs **once**: a second launch quits at once (and, on macOS, never shows a Dock icon). Start with `--next2d-allow-multiple` to run several copies while developing.
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.

After sleep (e.g. closing a laptop lid) the GPU may be reset and drawing stops, so the page (renderer) is loaded again; the game should save automatically. Power, display and GPU events are logged to `userData/diagnostics.log` (Windows: `%APPDATA%\<appId>\diagnostics.log`).

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next2d/builder",
"version": "0.4.6",
"version": "0.4.7",
"description": "Multi-platform builder for Next2d Framework, supporting export to various platforms such as macOS, Windows, iOS, Android and Web(HTML)",
"author": "Toshiyuki Ienaga <ienaga@next2d.app>",
"license": "MIT",
Expand Down
3 changes: 1 addition & 2 deletions src/electron-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ export const createElectronPackagerOptions = (
...os === "macos" && (config.macos.localNetworkUsageDescription || config.window.overlay?.enabled) ? {
"extendInfo": {
...config.macos.localNetworkUsageDescription ? { "NSLocalNetworkUsageDescription": config.macos.localNetworkUsageDescription } : {},
// An overlay starts as an agent app (no Dock icon) so that a second launch, which quits at once,
// never shows one. The first instance shows its Dock icon itself (templates/electron/index.js).
// An overlay is an agent app: no Dock icon, also for a second launch that quits at once.
...config.window.overlay?.enabled ? { "LSUIElement": true } : {}
},
...config.macos.localNetworkUsageDescription ? {
Expand Down
5 changes: 2 additions & 3 deletions templates/electron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,8 @@ const createWindow = async () => {

app.whenReady().then(async () => {
if (!hasLock) return;
// The overlay app is packaged as an agent app (LSUIElement) so a second launch never shows a Dock icon;
// the instance that keeps running shows it.
if (process.platform === "darwin" && overlay) app.dock?.show();
// The overlay app is packaged as an agent app (LSUIElement): it never shows a Dock icon (a desktop pet stays out
// of the Dock and the app switcher; the game offers its own "quit").
Menu.setApplicationMenu(process.platform === "darwin" ? Menu.buildFromTemplate([
{ role: "appMenu" }, { role: "editMenu" }, { role: "windowMenu" }
]) : null);
Expand Down
4 changes: 2 additions & 2 deletions tests/electron-overlay.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ test("a desktop overlay runs once: a second launch quits before any window or Do
const first = await startHost(t, { window: { overlay: { enabled: true, clickThrough: true } } });
assert.equal(first.windows.length, 1);
assert.equal(first.calls.some(([name]) => name === "exit"), false);
// The running instance shows its Dock icon itself (the app is packaged as an agent app).
assert.equal(first.calls.some(([name]) => name === "dock.show"), process.platform === "darwin");
// The overlay is an agent app: no instance shows a Dock icon.
assert.equal(first.calls.some(([name]) => name === "dock.show"), false);
assert.equal(denied.calls.some(([name]) => name === "dock.show"), false);
first.calls.length = 0;
first.appListeners.get("second-instance")();
Expand Down
2 changes: 1 addition & 1 deletion tests/electron.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test("macOS local network purpose is opt-in and applied to the app and helpers",
assert.equal(createElectronPackagerOptions(root, config, "linux", root).extendHelperInfo, undefined);
fs.writeFileSync(path.join(root, "electron.config.json"), "{}");
assert.equal(createElectronPackagerOptions(root, readElectronConfig(root), "macos", root).extendInfo, undefined);
// An overlay is packaged as an agent app (no Dock icon until the running instance shows it).
// An overlay is packaged as an agent app (never a Dock icon).
fs.writeFileSync(path.join(root, "electron.config.json"), JSON.stringify({ window: { overlay: { enabled: true } } }));
const overlay = createElectronPackagerOptions(root, readElectronConfig(root), "macos", root);
assert.deepEqual(overlay.extendInfo, { LSUIElement: true });
Expand Down
Loading