-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
executable file
·55 lines (46 loc) · 1.38 KB
/
main.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
46
47
48
49
50
51
52
53
54
55
//
// Main.js
// Electron/Node setup
// (using basic flow from http://duckysoftware.com/?p=1110
// and Benja template)
//
// To have access to local or global scripts
require(process.cwd() + '/node_modules/benja').paths();
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
//const path = require('path');
//const url = require('url');
// in case by default WebGL doesn't work ... (rpi or others)
app.commandLine.appendSwitch('--ignore-gpu-blacklist');
app.once('ready', () => {
const area = electron.screen.getPrimaryDisplay().workAreaSize;
this.window = new BrowserWindow({
backgroundColor: '#000000',
frame: false,
fullscreen: true,
x: 0,
y: 0,
width: area.width,
height: area.height
});
this.window.once('closed', () => {
// cleanup the reference
this.window = null;
});
let url = require('url').format({
protocol: 'file',
slashes: true,
pathname: require('path').join(__dirname, 'index.html')
});
this.window.loadURL(url);
// test CSS
// .loadURL('https://codepen.io/bennettfeely/full/tfbCo/');
// test WebGL
// .loadURL('http://get.webgl.org/');
// stress WebGL
// .loadURL('https://threejs.org/examples/webgl_geometry_cube.html');
// for debugging purpose, it might be handy to be able
// to reload the window simply via `touch ~/app/reload`
require('fs').watch('reload', () => app.quit());
});