From 202e97ac5ae355ea0558e571b0bd206376c2dca1 Mon Sep 17 00:00:00 2001 From: X3F200C Date: Mon, 13 Nov 2023 18:09:20 -0500 Subject: [PATCH] Add basic Electron window --- main.js | 30 ++++++++++++++++++++++++++++++ meta.json | 5 +++++ package.json | 13 +++++++++++++ preload.js | 0 sources.json | 5 +++++ views/main.html | 12 ++++++++++++ 6 files changed, 65 insertions(+) create mode 100644 main.js create mode 100644 meta.json create mode 100644 package.json create mode 100644 preload.js create mode 100644 sources.json create mode 100644 views/main.html diff --git a/main.js b/main.js new file mode 100644 index 0000000..2550ab1 --- /dev/null +++ b/main.js @@ -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(); +}); diff --git a/meta.json b/meta.json new file mode 100644 index 0000000..cbb34f5 --- /dev/null +++ b/meta.json @@ -0,0 +1,5 @@ +{ + "minecraft": { + "version": "${MINECRAFT_VERSION}" + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..3e4fc1c --- /dev/null +++ b/package.json @@ -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 ", + "license": "GNU-GPLv3", + "private": false, + "scripts": { + "start": "electron ." + } +} diff --git a/preload.js b/preload.js new file mode 100644 index 0000000..e69de29 diff --git a/sources.json b/sources.json new file mode 100644 index 0000000..51218a7 --- /dev/null +++ b/sources.json @@ -0,0 +1,5 @@ +{ + "minecraft": { + "versions_manifest": "https://launchermeta.mojang.com/mc/game/version_manifest_v2.json" + } +} diff --git a/views/main.html b/views/main.html new file mode 100644 index 0000000..381c543 --- /dev/null +++ b/views/main.html @@ -0,0 +1,12 @@ + + + + + OpenModLauncher + + +
+ +
+ +