Add basic Electron window

This commit is contained in:
X3F200C 2023-11-13 18:09:20 -05:00
parent d9d1a10e78
commit 202e97ac5a
6 changed files with 65 additions and 0 deletions

30
main.js Normal file
View File

@ -0,0 +1,30 @@
const path = require("node:path");
const child_process = require("node:child_process");
const electron = require("electron");
electron.app.on("ready", function () {
window = new electron.BrowserWindow({
"width": 960,
"height": 560,
"webPreferences": {
"nodeIntegration": true,
"contextIsolation": true,
"preload": path.join(__dirname, "preload.js")
},
"title": "OpenModLauncher",
"icon": path.join(__dirname, "res", "img", "logo.png"),
"frame": true,
"transparent": true,
"resizable": false,
"show": false
});
window.loadFile(path.join(__dirname, "views", "main.html"));
window.on("ready-to-show", window.show);
});
electron.app.on("window-all-closed", function () {
electron.app.quit();
});

5
meta.json Normal file
View File

@ -0,0 +1,5 @@
{
"minecraft": {
"version": "${MINECRAFT_VERSION}"
}
}

13
package.json Normal file
View File

@ -0,0 +1,13 @@
{
"name": "openmodlauncher",
"version": "0.0.1",
"description": "A small Minecraft launcher codebase",
"main": "main.js",
"repository": "https://gitea.x3f200c.net/X3F200C/OpenModLauncher-Base.git",
"author": "X3F200C <x3f200c@x3f200c.net>",
"license": "GNU-GPLv3",
"private": false,
"scripts": {
"start": "electron ."
}
}

0
preload.js Normal file
View File

5
sources.json Normal file
View File

@ -0,0 +1,5 @@
{
"minecraft": {
"versions_manifest": "https://launchermeta.mojang.com/mc/game/version_manifest_v2.json"
}
}

12
views/main.html Normal file
View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>OpenModLauncher</title>
</head>
<body>
<div id="titlebar">
</div>
</body>
</html>