Skip to content

Commit

Permalink
Merge pull request #6 from jsmolina/feat/vite-electron
Browse files Browse the repository at this point in the history
migrate to vite and add electron
  • Loading branch information
jsmolina authored Aug 6, 2024
2 parents 5ddf78f + 7f46767 commit 0c1d0f8
Show file tree
Hide file tree
Showing 46 changed files with 9,601 additions and 10,901 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist
exe/
.DS_Store
.idea
# Logs
Expand Down
Binary file removed docs/1d57a79d6e63bcd8f625.png
Binary file not shown.
1 change: 1 addition & 0 deletions docs/assets/index-yFHXXoxu.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/assets/phaser-DqFVsdsa.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions docs/b88d04fba731603756b1.css

This file was deleted.

Binary file removed docs/f91aec86ba64dfaa3d2c.ttf
Binary file not shown.
23 changes: 22 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"><link rel="stylesheet" href="b88d04fba731603756b1.css"/><title>Hero and Princess</title><script defer="defer" src="main.js"></script><link href="main.css" rel="stylesheet"></head><body><div class="fontPreload">main</div><div class="game-area"><div class="tablier"><canvas id="game-canvas">You need JS.</canvas></div></div></body></html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" href="./main.css"/>
<title>Hero and Princess</title>
<script type="module" crossorigin src="./assets/index-yFHXXoxu.js"></script>
<link rel="modulepreload" crossorigin href="./assets/phaser-DqFVsdsa.js">
</head>
<body>
<div class="fontPreload">main</div>
<div class="game-area">
<div class="tablier">
<canvas id="game-canvas">You need JS.</canvas>
</div>
<div class="help">Use keys+space. Shift to reset it.</div>
</div>


</body>
</html>
5 changes: 4 additions & 1 deletion docs/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ time, mark, audio, video {

@font-face {
font-family: CustomFont;
src: url(f91aec86ba64dfaa3d2c.ttf);
src: url('/assets/ONESIZE.TTF');
font-style: normal;
}

Expand Down Expand Up @@ -79,3 +79,6 @@ body {
background-color: #5f0d11;
}

.help {
color: grey;
}
2 changes: 0 additions & 2 deletions docs/main.js

This file was deleted.

156 changes: 0 additions & 156 deletions docs/main.js.LICENSE.txt

This file was deleted.

Binary file added icon.icns
Binary file not shown.
Binary file added icon.ico
Binary file not shown.
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<div class="tablier">
<canvas id="game-canvas">You need JS.</canvas>
</div>
<script type="module" src="src/game.js"></script>
<div class="help">Use keys+space. Shift to reset it.</div>
</div>


Expand Down
66 changes: 66 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const { app, BrowserWindow, ipcMain } = require("electron");
const path = require("path");

// Let electron reloads by itself
if (
process.env.ELECTRON_DEBUG === "true" ||
process.env.ELECTRON_DEBUG === "vscode"
) {
require("electron-reload")(__dirname, {});
}

function createWindow() {
// Create the browser window.
const mainWindow = new BrowserWindow({
autoHideMenuBar: true,
title: "Hero and Princess2",
center: true,
// useContentSize: true,
frame: false,
width: 500,
height: 780,
webPreferences: {
nodeIntegration: true,
},
});
mainWindow.setMenuBarVisibility(false)

// Hot reload
if (process.env.ELECTRON_HOT === "true") {
mainWindow.loadURL("http://localhost:8080");
} else {
// and load the index.html of the app.
mainWindow.loadFile(path.join(__dirname, "dist/index.html"));
}

if (process.env.ELECTRON_DEBUG === "true") {
// Open the DevTools.
mainWindow.webContents.openDevTools();
}

// keep ratio when scaling
mainWindow.setAspectRatio(0.58);
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on("ready", createWindow);

// Quit when all windows are closed.
app.on("window-all-closed", () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
//if (process.platform !== "darwin") {
app.quit();
//}
});

app.on("activate", () => {
// On OS X it"s common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});

// In this file you can include the rest of your app"s specific main process
// code. You can also put them in separate files and require them here.
Loading

0 comments on commit 0c1d0f8

Please sign in to comment.