-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathmain.js
More file actions
80 lines (70 loc) · 1.74 KB
/
Copy pathmain.js
File metadata and controls
80 lines (70 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
const { app, BrowserWindow, Menu } = require('electron');
const path = require('path');
// Required for Steam overlay compatibility with Chromium
app.commandLine.appendSwitch('in-process-gpu');
// Initialize Steam SDK (graceful fallback for non-Steam launches)
let steamClient = null;
try {
const steamworks = require('steamworks.js');
steamClient = steamworks.init(YOUR_APP_ID); // Replace YOUR_APP_ID with your numeric Steam App ID
} catch (err) {
console.warn('Steam SDK not available:', err.message);
}
function createWindow() {
const win = new BrowserWindow({
width: 1920,
height: 1080,
fullscreen: true,
title: 'GoMud Client',
webPreferences: {
contextIsolation: true,
nodeIntegration: false,
},
});
win.loadFile(path.join(__dirname, 'build_cache', 'webclient-pure.html'));
if (process.argv.includes('--dev')) {
win.webContents.openDevTools();
}
}
function buildMenu() {
const template = [
...(process.platform === 'darwin' ? [{
label: app.name,
submenu: [
{ role: 'about' },
{ type: 'separator' },
{ role: 'quit' },
],
}] : []),
{
label: 'View',
submenu: [
{ role: 'togglefullscreen' },
{ role: 'resetZoom' },
{ role: 'zoomIn' },
{ role: 'zoomOut' },
],
},
{
label: 'Edit',
submenu: [
{ role: 'copy' },
{ role: 'paste' },
{ role: 'selectAll' },
],
},
];
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
}
app.whenReady().then(() => {
buildMenu();
createWindow();
});
app.on('window-all-closed', () => {
app.quit();
});
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});