mirror of
https://github.com/AltarikMC/Launcher
synced 2024-11-21 06:09:51 +01:00
added possibility to change memory allocated values + added notification when mc stopped with a non zero exit + added material-icons locally
This commit is contained in:
parent
54b32045e9
commit
ee2d5b43a6
@ -2,6 +2,6 @@
|
||||
|
||||
## Dependencies
|
||||
|
||||
<https://www.npmjs.com/package/electron>
|
||||
<https://www.npmjs.com/package/minecraft-launcher-core>
|
||||
|
||||
- <https://www.npmjs.com/package/electron>
|
||||
- <https://www.npmjs.com/package/minecraft-launcher-core>
|
||||
- <https://github.com/nwutils/create-desktop-shortcuts>
|
||||
|
@ -1,6 +1,3 @@
|
||||
minMem= "2G"
|
||||
maxMem = "4G"
|
||||
|
||||
let launchBtn = document.querySelector('#launch-btn');
|
||||
let fullProgressBar = document.querySelector('#fullprogressbar')
|
||||
let progressBar = document.querySelector('#progressbar')
|
||||
@ -17,10 +14,14 @@ launchBtn.addEventListener("click", e => {
|
||||
fullProgressBar.classList.remove('hidden');
|
||||
loadingMessage.classList.remove('hidden');
|
||||
ipcRenderer.send('launch', {
|
||||
minMem: minMem,
|
||||
maxMem: maxMem
|
||||
minMem: document.querySelector('#minMem').value,
|
||||
maxMem: document.querySelector('#maxMem').value
|
||||
})
|
||||
launchBtn.disabled = true
|
||||
if(document.querySelector('#minMem').value.trim() && document.querySelector('#maxMem').value.trim()){
|
||||
localStorage.setItem("minMem", document.querySelector('#minMem').value.trim())
|
||||
localStorage.setItem("maxMem", document.querySelector('#maxMem').value.trim())
|
||||
}
|
||||
})
|
||||
|
||||
ipcRenderer.on("progress", (e, args) => {
|
||||
@ -39,4 +40,9 @@ ipcRenderer.on("close", (e, args) => {
|
||||
|
||||
disconnectBtn.addEventListener('click', e => {
|
||||
ipcRenderer.send('disconnect')
|
||||
})
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
document.querySelector('#minMem').value = localStorage.getItem("minMem") != null ? localStorage.getItem("minMem") : "2G"
|
||||
document.querySelector('#maxMem').value = localStorage.getItem("maxMem") != null ? localStorage.getItem("maxMem") : "4G"
|
||||
})
|
23
include/material-icons.css
Normal file
23
include/material-icons.css
Normal file
@ -0,0 +1,23 @@
|
||||
/* fallback */
|
||||
@font-face {
|
||||
font-family: 'Material Icons';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(material-icons.woff2) format('woff2');
|
||||
}
|
||||
|
||||
.material-icons {
|
||||
font-family: 'Material Icons';
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-size: 24px;
|
||||
line-height: 1;
|
||||
letter-spacing: normal;
|
||||
text-transform: none;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
word-wrap: normal;
|
||||
direction: ltr;
|
||||
-webkit-font-feature-settings: 'liga';
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
BIN
include/material-icons.woff2
Normal file
BIN
include/material-icons.woff2
Normal file
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
<link href="include/index.css" rel="stylesheet" />
|
||||
<link href="include/menubar.css" rel="stylesheet" />
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<link href="include/material-icons.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div id="menubar">
|
||||
@ -25,7 +25,11 @@
|
||||
<button id="disconnect-btn">Se déconnecter</button>
|
||||
<h3>Modifier la configuration</h3>
|
||||
<hr>
|
||||
Contenu
|
||||
<h4>Allocation mémoire</h4>
|
||||
<label for="minMem">mémoire minimale</label>
|
||||
<input type="text" id="minMem" value="2G">
|
||||
<label for="minMem">mémoire maximale</label>
|
||||
<input type="text" id="maxMem" value="4G">
|
||||
</div>
|
||||
<div id="main">
|
||||
<img id="main-img" src="include/maxresdefault.jpg">
|
||||
|
@ -6,7 +6,7 @@
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
<link href="include/login.css" rel="stylesheet" />
|
||||
<link href="include/menubar.css" rel="stylesheet" />
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<link href="include/material-icons.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div id="menubar">
|
||||
|
9
main.js
9
main.js
@ -89,10 +89,15 @@ ipcMain.on("launch", (event, args) => {
|
||||
}
|
||||
}
|
||||
launcher.launch(opts)
|
||||
launcher.on('debug', (e) => console.log("debug", e));
|
||||
// launcher.on('debug', (e) => console.log("debug", e));
|
||||
launcher.on('data', (e) => console.log("data", e));
|
||||
launcher.on('progress', (e) => event.sender.send("progress", e));
|
||||
launcher.on('close', (e) => event.sender.send("close", e));
|
||||
launcher.on('close', (e) => {
|
||||
event.sender.send("close", e)
|
||||
if(e !== 0){
|
||||
showNotification("Une erreur est suvenue", "Minecraft ne s'est pas fermé correctement")
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user