-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.js
108 lines (94 loc) · 2.78 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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
const electron = require("electron");
const url = require("url"); // *Hangi HTML sayfasını kullancağımızı belirler.
const path = require("path");
const { protocol } = require("electron");
const remote = electron.remote;
const { app, BrowserWindow, ipcMain } = electron;
let mainWindow, addWindow;
// *Uygulama hazır olduğunda ilk çalışan fonksiyon.
app.on("ready", () => {
console.log("Uygulama çalıştı.");
mainWindow = new BrowserWindow({
webPreferences: {
//* Frontend kısmında "Electron require() is not defined" hata çözümü.
nodeIntegration: true,
contextIsolation: false,
},
width: 1000,
height: 543,
resizable: true, // *Ekran boyutu imleç ile değiştirilemez.
maximizable: false, // *Ekran maksimum hale getirilemez
backgroundColor: "#d5ecc2",
icon:"./assets/image/mangalaLogo.png"
});
mainWindow.setMenu(null);
mainWindow.loadURL(
url.format({
pathname: path.join(__dirname, "main.html"),
protocol: "file:",
slashes: true,
})
);
mainWindow.on("close", () => {
app.quit();
});
ipcMain.on("btnClick", (err, data) => {
console.log(data);
});
ipcMain.on("key:settingScreen", () => {
//createWİndow();
console.log("key:settingScreen");
});
//Yeni pencere
ipcMain.on("key:newWindow", () => {
addWindow = new BrowserWindow({
webPreferences: {
//* Frontend kısmında "Electron require() is not defined" hata çözümü.
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
},
width: 430,
height: 300,
title: "Oyun Ayarları",
frame: false,
resizable: false, // *Ekran boyutu imleç ile değiştirilemez.
maximizable: true, // *Ekran maksimum hale getirilemez
});
addWindow.loadURL(
url.format({
pathname: path.join(__dirname, "./pages/settings.html"),
protocol: "file:",
slashes: true,
})
);
});
ipcMain.on("key:newWindow2", () => {
addWindow = new BrowserWindow({
webPreferences: {
//* Frontend kısmında "Electron require() is not defined" hata çözümü.
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
},
width: 430,
height: 300,
title: "Oyun Ayarları",
frame: false,
resizable: false, // *Ekran boyutu imleç ile değiştirilemez.
maximizable: true, // *Ekran maksimum hale getirilemez
parent:mainWindow
});
addWindow.loadURL(
url.format({
pathname: path.join(__dirname, "./pages/turnBackMain.html"),
protocol: "file:",
slashes: true,
})
);
});
//Pencereyi Kapat
ipcMain.on("key:closeWindow", () => {
remote.getCurrentWindow().close();
});
});