mirror of
https://github.com/danbulant/arcade-machine
synced 2026-07-03 10:00:45 +00:00
format
This commit is contained in:
parent
835b8b5c2e
commit
ce10af9732
3 changed files with 236 additions and 217 deletions
341
ui/index.html
341
ui/index.html
|
|
@ -1,178 +1,201 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
<head>
|
<meta charset="UTF-8" />
|
||||||
<meta charset="UTF-8">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<link rel="stylesheet" href="style.css" />
|
||||||
<link rel="stylesheet" href="style.css">
|
|
||||||
<title>UI</title>
|
<title>UI</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
|
||||||
<script src="Vars.js">
|
|
||||||
</script> <!--Loadne Vars.js-->
|
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<script src="Vars.js"></script>
|
||||||
|
<!--Loadne Vars.js-->
|
||||||
|
|
||||||
<div class="hlavnidiv">
|
<div class="hlavnidiv">
|
||||||
<div class="container">
|
<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
|
<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-->
|
game path select-->
|
||||||
<img id="img1" src="" alt="">
|
<img id="img1" src="" alt="" />
|
||||||
<h1 class="sex" id="title1"></h1>
|
<h1 class="sex" id="title1"></h1>
|
||||||
</button> <!--SDVX3-->
|
</button>
|
||||||
<button class="move" type="button" id="sdvx4-button" onclick="vers=2;sdvx()">
|
<!--SDVX3-->
|
||||||
<img id="img2" src="" alt="">
|
<button
|
||||||
<h1 class="sex" id="title2"></h1>
|
class="move"
|
||||||
</button> <!--SDVX4-->
|
type="button"
|
||||||
<button class="move" type="button" id="sdvx5-button" onclick="vers=3;sdvx()">
|
id="sdvx4-button"
|
||||||
<img id="img3" src="" alt="">
|
onclick="vers=2;sdvx()"
|
||||||
<h1 class="sex" id="title3"></h1>
|
>
|
||||||
</button>
|
<img id="img2" src="" alt="" />
|
||||||
<button class="move" type="button" id="sdvx6-button" onclick="vers=4;sdvx()">
|
<h1 class="sex" id="title2"></h1>
|
||||||
<img id="img4" src="" alt="">
|
</button>
|
||||||
<h1 class="sex" id="title4"></h1>
|
<!--SDVX4-->
|
||||||
</button> <!--SDVX5-->
|
<button
|
||||||
<button class="move" type="button" id="sdvx7-button" onclick="vers=7;sdvx()">
|
class="move"
|
||||||
<img id="img5" src="" alt="">
|
type="button"
|
||||||
<h1 class="sex" id="title5"></h1>
|
id="sdvx5-button"
|
||||||
</button> <!--SDVX5-->
|
onclick="vers=3;sdvx()"
|
||||||
<button class="move" type="button" id="sdvx6-button" onclick="vers=8;sdvx()">
|
>
|
||||||
<img id="img6" src="" alt="">
|
<img id="img3" src="" alt="" />
|
||||||
<h1 class="sex" id="title6"></h1>
|
<h1 class="sex" id="title3"></h1>
|
||||||
</button> <!--SDVX5-->
|
</button>
|
||||||
|
<button
|
||||||
|
class="move"
|
||||||
</div>
|
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>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
document.getElementById("img1").src = ImgPath1; //Sets Button Imgs
|
document.getElementById('img1').src = ImgPath1 //Sets Button Imgs
|
||||||
document.getElementById("img2").src = ImgPath2;
|
document.getElementById('img2').src = ImgPath2
|
||||||
document.getElementById("img3").src = ImgPath3;
|
document.getElementById('img3').src = ImgPath3
|
||||||
document.getElementById("img4").src = ImgPath4;
|
document.getElementById('img4').src = ImgPath4
|
||||||
document.getElementById("img5").src = ImgPath5;
|
document.getElementById('img5').src = ImgPath5
|
||||||
document.getElementById("img6").src = ImgPath6;
|
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('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>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const prvnihra = [...document.querySelectorAll("button")] //creates array from buttons for focus select
|
const prvnihra = [...document.querySelectorAll('button')] //creates array from buttons for focus select
|
||||||
console.log(prvnihra[0])
|
console.log(prvnihra[0])
|
||||||
prvnihra[0].focus();
|
prvnihra[0].focus()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
//SFX Audio Sources
|
//SFX Audio Sources
|
||||||
var i = 0;
|
var i = 0
|
||||||
const switchfocus = new Audio("Audio/switchfocus.mp3");
|
const switchfocus = new Audio('Audio/switchfocus.mp3')
|
||||||
const startaudio = new Audio("Audio/audiostart4.mp3")
|
const startaudio = new Audio('Audio/audiostart4.mp3')
|
||||||
/* Handles interaction with bindable buttons and focus*/
|
/* Handles interaction with bindable buttons and focus*/
|
||||||
document.addEventListener("keydown", function (KeypressD) {
|
document.addEventListener('keydown', function (KeypressD) {
|
||||||
if (KeypressD.code === KeyRight) {
|
if (KeypressD.code === KeyRight) {
|
||||||
if (i >= prvnihra.length - 1) i = -1;
|
if (i >= prvnihra.length - 1) i = -1
|
||||||
switchfocus.play(); //plays audio
|
switchfocus.play() //plays audio
|
||||||
i++;
|
i++
|
||||||
prvnihra[i].focus();
|
prvnihra[i].focus()
|
||||||
console.log("right", i);
|
console.log('right', i)
|
||||||
console.log("array je", prvnihra.length);
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
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>
|
||||||
</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>
|
||||||
|
|
|
||||||
97
ui/main.js
97
ui/main.js
|
|
@ -1,63 +1,68 @@
|
||||||
const { app, BrowserWindow, ipcMain } = require('electron');
|
const { app, BrowserWindow, ipcMain } = require('electron')
|
||||||
const { globalShortcut } = require('electron');
|
const { globalShortcut } = require('electron')
|
||||||
const createWindow = () => {
|
const createWindow = () => {
|
||||||
ipcMain.on("number",(event,data)=>{ //Reads number var from index
|
ipcMain.on('number', (event, data) => {
|
||||||
Execounter = 0;
|
//Reads number var from index
|
||||||
|
Execounter = 0
|
||||||
console.warn(data)
|
console.warn(data)
|
||||||
Execounter = data;
|
Execounter = data
|
||||||
console.warn(Execounter)
|
console.warn(Execounter)
|
||||||
})
|
})
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 600,
|
height: 600,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
enableRemoteModule: true
|
enableRemoteModule: true,
|
||||||
},
|
},
|
||||||
autoHideMenuBar: true
|
autoHideMenuBar: true,
|
||||||
});
|
})
|
||||||
mainWindow.loadFile("index.html") //loads index.html
|
mainWindow.loadFile('index.html') //loads index.html
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
createWindow();
|
createWindow()
|
||||||
|
|
||||||
const { ExitKey1, ExitKey2, GameExe1, GameExe2, GameExe3, GameExe4, GameExe5, GameExe6 } = require("./Vars.js") //imports exitkeys from vars.js
|
const {
|
||||||
const { execFile, exec, spawn } = require('child_process');
|
ExitKey1,
|
||||||
console.log(ExitKey1 + " + " + ExitKey2);
|
ExitKey2,
|
||||||
|
GameExe1,
|
||||||
|
GameExe2,
|
||||||
const ret = globalShortcut.register(ExitKey1 + " + " + ExitKey2, () => { //makes globalshortcut from vars in vars.js
|
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')
|
console.log('CommandOrControl+X is pressed')
|
||||||
//On shortcut kills game exe
|
//On shortcut kills game exe
|
||||||
switch(Execounter){
|
switch (Execounter) {
|
||||||
case 1:
|
case 1:
|
||||||
exec("taskkill /im " + GameExe1);
|
exec('taskkill /im ' + GameExe1)
|
||||||
break;
|
break
|
||||||
case 2:
|
case 2:
|
||||||
exec("taskkill /im " + GameExe2);
|
exec('taskkill /im ' + GameExe2)
|
||||||
break;
|
break
|
||||||
case 3:
|
case 3:
|
||||||
exec("taskkill /im " + GameExe3);
|
exec('taskkill /im ' + GameExe3)
|
||||||
break;
|
break
|
||||||
case 4:
|
case 4:
|
||||||
exec("taskkill /im " + GameExe4);
|
exec('taskkill /im ' + GameExe4)
|
||||||
break;
|
break
|
||||||
case 5:
|
case 5:
|
||||||
exec("taskkill /im " + GameExe5);
|
exec('taskkill /im ' + GameExe5)
|
||||||
break;
|
break
|
||||||
case 6:
|
case 6:
|
||||||
exec("taskkill /im " + GameExe6);
|
exec('taskkill /im ' + GameExe6)
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
})
|
||||||
|
|
|
||||||
15
ui/style.css
15
ui/style.css
|
|
@ -9,15 +9,11 @@
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
/*background-color: rgb(56, 55, 55, 1);*/
|
/*background-color: rgb(56, 55, 55, 1);*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
|
|
@ -36,8 +32,6 @@ body {
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
position: relative;
|
position: relative;
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.move img {
|
.move img {
|
||||||
|
|
@ -55,7 +49,6 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.sex {
|
.sex {
|
||||||
|
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
bottom: 110px;
|
bottom: 110px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
@ -64,8 +57,6 @@ body {
|
||||||
/* color: rgb(15, 12, 12, 0.88); */
|
/* color: rgb(15, 12, 12, 0.88); */
|
||||||
font-family: Verdana, Geneva, Tahoma, sans-serif;
|
font-family: Verdana, Geneva, Tahoma, sans-serif;
|
||||||
font-weight: bolder;
|
font-weight: bolder;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes blik {
|
@keyframes blik {
|
||||||
|
|
@ -92,7 +83,7 @@ body {
|
||||||
.move:focus h1 {
|
.move:focus h1 {
|
||||||
transition: opacity 1s, bottom 0.8s;
|
transition: opacity 1s, bottom 0.8s;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
opacity: 0.90;
|
opacity: 0.9;
|
||||||
|
|
||||||
bottom: 80px;
|
bottom: 80px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -101,7 +92,7 @@ body {
|
||||||
.move:focus img {
|
.move:focus img {
|
||||||
transition: opacity 0.6s, filter 1s;
|
transition: opacity 0.6s, filter 1s;
|
||||||
opacity: 0.68;
|
opacity: 0.68;
|
||||||
filter: blur(2.2px);
|
filter: blur(2.2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.move img {
|
.move img {
|
||||||
|
|
@ -113,4 +104,4 @@ body {
|
||||||
aspect-ratio: 3/4;
|
aspect-ratio: 3/4;
|
||||||
background-image: url("JPGS/BACKGROUND GOOD.png");
|
background-image: url("JPGS/BACKGROUND GOOD.png");
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue