-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made a Simple GUI using Electron and Tried Making a GUI using Nana an…
…d ImGui
- Loading branch information
1 parent
0e32ada
commit df22a3e
Showing
120 changed files
with
19,876 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --> | ||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'"> | ||
<title>Hello World!</title> | ||
</head> | ||
<body> | ||
Title: <input id="title"/> | ||
<button id="btn" type="button">Set</button> | ||
<script src="./renderer.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
const { app, BrowserWindow, ipcMain } = require('electron') | ||
const path = require('node:path') | ||
|
||
function createWindow () { | ||
const mainWindow = new BrowserWindow({ | ||
webPreferences: { | ||
preload: path.join(__dirname, 'preload.js') | ||
} | ||
}) | ||
|
||
ipcMain.on('set-title', (event, title) => { | ||
const webContents = event.sender | ||
const win = BrowserWindow.fromWebContents(webContents) | ||
win.setTitle(title) | ||
}) | ||
|
||
mainWindow.loadFile('index.html') | ||
} | ||
|
||
app.whenReady().then(() => { | ||
createWindow() | ||
|
||
app.on('activate', function () { | ||
if (BrowserWindow.getAllWindows().length === 0) createWindow() | ||
}) | ||
}) | ||
|
||
app.on('window-all-closed', function () { | ||
if (process.platform !== 'darwin') app.quit() | ||
}) | ||
|
||
|
||
// const { app, BrowserWindow, ipcMain, dialog } = require('electron') | ||
// const path = require('node:path') | ||
|
||
// async function handleFileOpen() { | ||
// const { canceled, filePaths } = await dialog.showOpenDialog() | ||
// if (!canceled) { | ||
// return filePaths[0] | ||
// } | ||
// } | ||
|
||
// function createWindow() { | ||
// const mainWindow = new BrowserWindow({ | ||
// webPreferences: { | ||
// preload: path.join(__dirname, 'preload.js') | ||
// } | ||
// }) | ||
// mainWindow.loadFile('index.html') | ||
// } | ||
|
||
// app.whenReady().then(() => { | ||
// ipcMain.handle('dialog:openFile', handleFileOpen) | ||
// createWindow() | ||
// app.on('activate', function () { | ||
// if (BrowserWindow.getAllWindows().length === 0) createWindow() | ||
// }) | ||
// }) | ||
|
||
// app.on('window-all-closed', function () { | ||
// if (process.platform !== 'darwin') app.quit() | ||
// }) |
Oops, something went wrong.