-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
45 lines (38 loc) · 1.13 KB
/
index.js
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
const { app, BrowserWindow, ipcMain, shell } = require('electron');
const path = require('path');
const sizes = {
width: 1280,
height: 720
}
let mainWindow;
app.whenReady().then(() => {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
icon: path.join(__dirname, 'icon.ico'),
autoHideMenuBar: true,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
mainWindow.loadFile('src/index.html');
ipcMain.on('open-game', (event, url, icon_name) => {
let gameWindow = new BrowserWindow({
width: sizes.width,
height: sizes.height,
icon: path.join(__dirname, 'src/assets/', icon_name),
autoHideMenuBar: true,
webPreferences: {
nodeIntegration: false
}
});
gameWindow.loadURL(url);
});
ipcMain.on('open-author-page', (event, url) => {
shell.openExternal(url);
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});