mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-23 18:20:19 +03:00
Add Splash
This commit is contained in:
parent
c000cd4e0e
commit
faf319d988
4 changed files with 42 additions and 3 deletions
26
entry.js
26
entry.js
|
@ -13,7 +13,7 @@ const path = require('path');
|
|||
|
||||
require('electron-store').initRenderer();
|
||||
|
||||
let mainWindow, analyticsWindow, settingsWindow;
|
||||
let mainWindow, analyticsWindow, settingsWindow, splashWindow;
|
||||
|
||||
ipcMain.handle('hide-window', () => mainWindow.hide());
|
||||
ipcMain.handle('show-window', () => mainWindow.show());
|
||||
|
@ -70,6 +70,7 @@ ipcMain.handle('hide-analytics-participation', () => analyticsWindow.close());
|
|||
|
||||
function createWindow ()
|
||||
{
|
||||
// Launcher
|
||||
// https://www.electronjs.org/docs/latest/api/browser-window/#class-browserwindow
|
||||
mainWindow = new BrowserWindow ({
|
||||
width: 1280,
|
||||
|
@ -85,7 +86,6 @@ function createWindow ()
|
|||
});
|
||||
|
||||
mainWindow.loadFile(path.join(__dirname, 'public', 'html', 'index.html'));
|
||||
mainWindow.once('ready-to-show', mainWindow.show);
|
||||
|
||||
// open URLs in Browser instead of an pop-up in electron app.
|
||||
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
|
||||
|
@ -93,8 +93,21 @@ function createWindow ()
|
|||
|
||||
return { action: 'deny' };
|
||||
});
|
||||
|
||||
|
||||
// mainWindow.webContents.openDevTools();
|
||||
|
||||
// Splash
|
||||
|
||||
splashWindow = new BrowserWindow({
|
||||
width: 250,
|
||||
height: 320,
|
||||
transparent: true,
|
||||
frame: false,
|
||||
icon: path.join(__dirname, 'public', 'images', 'icons', '64x64.png'),
|
||||
autoHideMenuBar: true
|
||||
});
|
||||
splashWindow.loadFile(path.join(__dirname, 'public', 'splash', 'index.html'));
|
||||
splashWindow.center();
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,6 +125,13 @@ app.whenReady().then(() => {
|
|||
createWindow();
|
||||
});
|
||||
|
||||
ipcMain.handle('loaded', () => {
|
||||
setTimeout(() => {
|
||||
mainWindow.show();
|
||||
splashWindow.close();
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
// This has to be here otherwise webContents is invalid
|
||||
ipcMain.on('change-lang', (event, args) => {
|
||||
mainWindow.webContents.send('change-lang', { 'lang': args.lang });
|
||||
|
|
18
public/splash/index.html
Normal file
18
public/splash/index.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<!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" />
|
||||
|
||||
<!-- CSS styles -->
|
||||
<link rel="stylesheet" href="../css/settings.css">
|
||||
|
||||
<title>An Anime Game Launcher</title>
|
||||
</head>
|
||||
|
||||
<body theme="dark" style="text-align: center;">
|
||||
<video src="./loading.webm" style="padding-top: 15%; padding-left: 5%;" width="60%" height="60%" loop muted autoplay></video>
|
||||
<h4 style="color: white; padding-top: 6%;">Starting Launcher...</h4>
|
||||
</body>
|
||||
</html>
|
BIN
public/splash/loading.webm
Normal file
BIN
public/splash/loading.webm
Normal file
Binary file not shown.
|
@ -97,6 +97,7 @@ $(() => {
|
|||
$('#settings').on('mouseleave', () => $('#settings').removeClass('hovered'));
|
||||
|
||||
LauncherLib.getData().then(async data => {
|
||||
ipcRenderer.invoke('loaded');
|
||||
await LauncherUI.updateLauncherState(data);
|
||||
|
||||
$('#launch').on('click', async () => {
|
||||
|
|
Loading…
Reference in a new issue