mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-21 01:13:37 +08:00
50 lines
989 B
JavaScript
50 lines
989 B
JavaScript
const {app, BrowserWindow} = require('electron')
|
|
const path = require('path')
|
|
const url = require('url')
|
|
|
|
let win
|
|
|
|
function createWindow () {
|
|
win = new BrowserWindow({
|
|
icon:'icon.ico',
|
|
show: false,
|
|
backgroundColor: '#21252b',
|
|
webPreferences: {
|
|
//experimentalFeatures: true,
|
|
webgl: true,
|
|
webSecurity: true,
|
|
nodeIntegration: true
|
|
}
|
|
})
|
|
var index_path = path.join(__dirname, 'index.html')
|
|
/*if (__dirname.includes('xampp\\htdocs\\')) {
|
|
index_path = path.join(__dirname, 'index.php')
|
|
}*/
|
|
win.setMenu(null);
|
|
win.maximize()
|
|
win.show()
|
|
win.loadURL(url.format({
|
|
pathname: index_path,
|
|
protocol: 'file:',
|
|
slashes: true
|
|
}))
|
|
win.on('closed', () => {
|
|
win = null
|
|
})
|
|
//win.webContents.openDevTools()
|
|
}
|
|
|
|
app.commandLine.appendSwitch('ignore-gpu-blacklist')
|
|
|
|
app.on('ready', createWindow)
|
|
|
|
app.on('window-all-closed', () => {
|
|
app.quit()
|
|
})
|
|
|
|
app.on('activate', () => {
|
|
if (win === null) {
|
|
createWindow()
|
|
}
|
|
})
|