This commit is contained in:
Daniel Bulant 2023-03-02 18:03:51 +01:00
parent 835b8b5c2e
commit ce10af9732
3 changed files with 236 additions and 217 deletions

View file

@ -1,178 +1,201 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>UI</title>
</head>
<body>
<script src="Vars.js">
</script> <!--Loadne Vars.js-->
</head>
<body>
<script src="Vars.js"></script>
<!--Loadne Vars.js-->
<div class="hlavnidiv">
<div class="container">
<button class="move" type="button" id="sdvx3-button" onclick="vers=1;sdvx()"> <!-- on click sets var vers to number and then runs sdvx which is just switch for
<div class="container">
<button
class="move"
type="button"
id="sdvx3-button"
onclick="vers=1;sdvx()"
>
<!-- on click sets var vers to number and then runs sdvx which is just switch for
game path select-->
<img id="img1" src="" alt="">
<h1 class="sex" id="title1"></h1>
</button> <!--SDVX3-->
<button class="move" type="button" id="sdvx4-button" onclick="vers=2;sdvx()">
<img id="img2" src="" alt="">
<h1 class="sex" id="title2"></h1>
</button> <!--SDVX4-->
<button class="move" type="button" id="sdvx5-button" onclick="vers=3;sdvx()">
<img id="img3" src="" alt="">
<h1 class="sex" id="title3"></h1>
</button>
<button class="move" type="button" id="sdvx6-button" onclick="vers=4;sdvx()">
<img id="img4" src="" alt="">
<h1 class="sex" id="title4"></h1>
</button> <!--SDVX5-->
<button class="move" type="button" id="sdvx7-button" onclick="vers=7;sdvx()">
<img id="img5" src="" alt="">
<h1 class="sex" id="title5"></h1>
</button> <!--SDVX5-->
<button class="move" type="button" id="sdvx6-button" onclick="vers=8;sdvx()">
<img id="img6" src="" alt="">
<h1 class="sex" id="title6"></h1>
</button> <!--SDVX5-->
</div>
<img id="img1" src="" alt="" />
<h1 class="sex" id="title1"></h1>
</button>
<!--SDVX3-->
<button
class="move"
type="button"
id="sdvx4-button"
onclick="vers=2;sdvx()"
>
<img id="img2" src="" alt="" />
<h1 class="sex" id="title2"></h1>
</button>
<!--SDVX4-->
<button
class="move"
type="button"
id="sdvx5-button"
onclick="vers=3;sdvx()"
>
<img id="img3" src="" alt="" />
<h1 class="sex" id="title3"></h1>
</button>
<button
class="move"
type="button"
id="sdvx6-button"
onclick="vers=4;sdvx()"
>
<img id="img4" src="" alt="" />
<h1 class="sex" id="title4"></h1>
</button>
<!--SDVX5-->
<button
class="move"
type="button"
id="sdvx7-button"
onclick="vers=7;sdvx()"
>
<img id="img5" src="" alt="" />
<h1 class="sex" id="title5"></h1>
</button>
<!--SDVX5-->
<button
class="move"
type="button"
id="sdvx6-button"
onclick="vers=8;sdvx()"
>
<img id="img6" src="" alt="" />
<h1 class="sex" id="title6"></h1>
</button>
<!--SDVX5-->
</div>
</div>
<script>
document.getElementById("img1").src = ImgPath1; //Sets Button Imgs
document.getElementById("img2").src = ImgPath2;
document.getElementById("img3").src = ImgPath3;
document.getElementById("img4").src = ImgPath4;
document.getElementById("img5").src = ImgPath5;
document.getElementById("img6").src = ImgPath6;
document.getElementById("title1").innerHTML = Title1;
document.getElementById("title2").innerHTML = Title2;
document.getElementById("title3").innerHTML = Title3;
document.getElementById("title4").innerHTML = Title4;
document.getElementById("title5").innerHTML = Title5;
document.getElementById("title6").innerHTML = Title6;
document.getElementById('img1').src = ImgPath1 //Sets Button Imgs
document.getElementById('img2').src = ImgPath2
document.getElementById('img3').src = ImgPath3
document.getElementById('img4').src = ImgPath4
document.getElementById('img5').src = ImgPath5
document.getElementById('img6').src = ImgPath6
document.getElementById('title1').innerHTML = Title1
document.getElementById('title2').innerHTML = Title2
document.getElementById('title3').innerHTML = Title3
document.getElementById('title4').innerHTML = Title4
document.getElementById('title5').innerHTML = Title5
document.getElementById('title6').innerHTML = Title6
</script>
<script>
const prvnihra = [...document.querySelectorAll("button")] //creates array from buttons for focus select
console.log(prvnihra[0])
prvnihra[0].focus();
const prvnihra = [...document.querySelectorAll('button')] //creates array from buttons for focus select
console.log(prvnihra[0])
prvnihra[0].focus()
</script>
<script>
//SFX Audio Sources
var i = 0;
const switchfocus = new Audio("Audio/switchfocus.mp3");
const startaudio = new Audio("Audio/audiostart4.mp3")
/* Handles interaction with bindable buttons and focus*/
document.addEventListener("keydown", function (KeypressD) {
if (KeypressD.code === KeyRight) {
if (i >= prvnihra.length - 1) i = -1;
switchfocus.play(); //plays audio
i++;
prvnihra[i].focus();
console.log("right", i);
console.log("array je", prvnihra.length);
}
})
document.addEventListener("keydown", function (Keypress) {
if (Keypress.code === KeyLeft) {
switchfocus.play();
if (i <= 0) i = prvnihra.length
i--;
prvnihra[i].focus()
console.log("left", i);
}
if (Keypress.code === KeyStart) {
startaudio.play();
console.log(document.activeElement);
document.activeElement.click();
}
if (Keypress.code === KeyDown && i + 3 < prvnihra.length) {
switchfocus.play();
console.log(i);
i = i + 3;
prvnihra[i].focus();
}
if (Keypress.code === KeyUp && i - 3 >= 0) {
switchfocus.play();
console.log(i);
i = i - 3;
prvnihra[i].focus();
}
//document.body.requestFullscreen();
})
</script>
<script>
var vers = 0;
const { execFile, exec, spawn } = require('child_process');
function sdvx() {
console.log("promenna", vers);
const { ipcRenderer } = require('electron');
/* Handles Running of apps */
switch (vers) {
case 1:
execFile(AsphyxiaPath);
exec("start /b " + GamePath1); //executes cmd with start and path
setTimeout(function () {
exec("taskkill /im " + browser)//kills browser
}, 1200)
//console.log(vers);
ipcRenderer.send("number", vers); //sends number to main which tells main what to kill on shortcut
break;
case 2:
execFile(AsphyxiaPath);
exec("start /b " + GamePath2);
setTimeout(function () {
exec("taskkill /im " + browser)
}, 1200)
ipcRenderer.send("number", vers);
break;
case 3:
execFile(AsphyxiaPath);
exec("start /b " + GamePath3);
setTimeout(function () {
exec("taskkill /im " + browser)
}, 1200)
ipcRenderer.send("number", vers);
break;
case 4:
execFile(AsphyxiaPath);
exec("start /b " + GamePath4);
setTimeout(function () {
exec("taskkill /im " + browser)
}, 1200)
ipcRenderer.send("number", vers);
break;
case 5:
execFile(GamePath5);
ipcRenderer.send("number", vers);
break;
case 6:
execFile(GamePath6);
ipcRenderer.send("number", vers);
default:
break;
}
//SFX Audio Sources
var i = 0
const switchfocus = new Audio('Audio/switchfocus.mp3')
const startaudio = new Audio('Audio/audiostart4.mp3')
/* Handles interaction with bindable buttons and focus*/
document.addEventListener('keydown', function (KeypressD) {
if (KeypressD.code === KeyRight) {
if (i >= prvnihra.length - 1) i = -1
switchfocus.play() //plays audio
i++
prvnihra[i].focus()
console.log('right', i)
console.log('array je', prvnihra.length)
}
})
document.addEventListener('keydown', function (Keypress) {
if (Keypress.code === KeyLeft) {
switchfocus.play()
if (i <= 0) i = prvnihra.length
i--
prvnihra[i].focus()
console.log('left', i)
}
if (Keypress.code === KeyStart) {
startaudio.play()
console.log(document.activeElement)
document.activeElement.click()
}
if (Keypress.code === KeyDown && i + 3 < prvnihra.length) {
switchfocus.play()
console.log(i)
i = i + 3
prvnihra[i].focus()
}
if (Keypress.code === KeyUp && i - 3 >= 0) {
switchfocus.play()
console.log(i)
i = i - 3
prvnihra[i].focus()
}
//document.body.requestFullscreen();
})
</script>
</body>
</html>
<script>
var vers = 0
const { execFile, exec, spawn } = require('child_process')
function sdvx() {
console.log('promenna', vers)
const { ipcRenderer } = require('electron')
/* Handles Running of apps */
switch (vers) {
case 1:
execFile(AsphyxiaPath)
exec('start /b ' + GamePath1) //executes cmd with start and path
setTimeout(function () {
exec('taskkill /im ' + browser) //kills browser
}, 1200)
//console.log(vers);
ipcRenderer.send('number', vers) //sends number to main which tells main what to kill on shortcut
break
case 2:
execFile(AsphyxiaPath)
exec('start /b ' + GamePath2)
setTimeout(function () {
exec('taskkill /im ' + browser)
}, 1200)
ipcRenderer.send('number', vers)
break
case 3:
execFile(AsphyxiaPath)
exec('start /b ' + GamePath3)
setTimeout(function () {
exec('taskkill /im ' + browser)
}, 1200)
ipcRenderer.send('number', vers)
break
case 4:
execFile(AsphyxiaPath)
exec('start /b ' + GamePath4)
setTimeout(function () {
exec('taskkill /im ' + browser)
}, 1200)
ipcRenderer.send('number', vers)
break
case 5:
execFile(GamePath5)
ipcRenderer.send('number', vers)
break
case 6:
execFile(GamePath6)
ipcRenderer.send('number', vers)
default:
break
}
}
</script>
</body>
</html>

View file

@ -1,63 +1,68 @@
const { app, BrowserWindow, ipcMain } = require('electron');
const { globalShortcut } = require('electron');
const { app, BrowserWindow, ipcMain } = require('electron')
const { globalShortcut } = require('electron')
const createWindow = () => {
ipcMain.on("number",(event,data)=>{ //Reads number var from index
Execounter = 0;
ipcMain.on('number', (event, data) => {
//Reads number var from index
Execounter = 0
console.warn(data)
Execounter = data;
Execounter = data
console.warn(Execounter)
})
})
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true
},
autoHideMenuBar: true
});
mainWindow.loadFile("index.html") //loads index.html
};
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
},
autoHideMenuBar: true,
})
mainWindow.loadFile('index.html') //loads index.html
}
app.whenReady().then(() => {
createWindow();
const { ExitKey1, ExitKey2, GameExe1, GameExe2, GameExe3, GameExe4, GameExe5, GameExe6 } = require("./Vars.js") //imports exitkeys from vars.js
const { execFile, exec, spawn } = require('child_process');
console.log(ExitKey1 + " + " + ExitKey2);
const ret = globalShortcut.register(ExitKey1 + " + " + ExitKey2, () => { //makes globalshortcut from vars in vars.js
createWindow()
const {
ExitKey1,
ExitKey2,
GameExe1,
GameExe2,
GameExe3,
GameExe4,
GameExe5,
GameExe6,
} = require('./Vars.js') //imports exitkeys from vars.js
const { execFile, exec, spawn } = require('child_process')
console.log(ExitKey1 + ' + ' + ExitKey2)
const ret = globalShortcut.register(ExitKey1 + ' + ' + ExitKey2, () => {
//makes globalshortcut from vars in vars.js
console.log('CommandOrControl+X is pressed')
//On shortcut kills game exe
switch(Execounter){
switch (Execounter) {
case 1:
exec("taskkill /im " + GameExe1);
break;
exec('taskkill /im ' + GameExe1)
break
case 2:
exec("taskkill /im " + GameExe2);
break;
exec('taskkill /im ' + GameExe2)
break
case 3:
exec("taskkill /im " + GameExe3);
break;
exec('taskkill /im ' + GameExe3)
break
case 4:
exec("taskkill /im " + GameExe4);
break;
exec('taskkill /im ' + GameExe4)
break
case 5:
exec("taskkill /im " + GameExe5);
break;
exec('taskkill /im ' + GameExe5)
break
case 6:
exec("taskkill /im " + GameExe6);
break;
exec('taskkill /im ' + GameExe6)
break
default:
break;
break
}
})
});
})

View file

@ -9,15 +9,11 @@
padding: 2rem;
margin: 0 auto;
/*background-color: rgb(56, 55, 55, 1);*/
}
body {
margin: 0;
overflow: hidden;
}
* {
@ -36,8 +32,6 @@ body {
border-radius: 15px;
position: relative;
border-radius: 15px;
}
.move img {
@ -55,7 +49,6 @@ body {
}
.sex {
opacity: 0;
bottom: 110px;
z-index: 1;
@ -64,8 +57,6 @@ body {
/* color: rgb(15, 12, 12, 0.88); */
font-family: Verdana, Geneva, Tahoma, sans-serif;
font-weight: bolder;
}
@keyframes blik {
@ -92,7 +83,7 @@ body {
.move:focus h1 {
transition: opacity 1s, bottom 0.8s;
z-index: 1;
opacity: 0.90;
opacity: 0.9;
bottom: 80px;
position: relative;
@ -101,7 +92,7 @@ body {
.move:focus img {
transition: opacity 0.6s, filter 1s;
opacity: 0.68;
filter: blur(2.2px);
filter: blur(2.2px);
}
.move img {
@ -113,4 +104,4 @@ body {
aspect-ratio: 3/4;
background-image: url("JPGS/BACKGROUND GOOD.png");
background-size: cover;
}
}