Strip out Electron and NodeJS-specific functions to get the game working on a basic level

This commit is contained in:
Stephen Jianu 2022-09-12 23:58:44 -05:00
commit fe0ec3a2c7
4 changed files with 16 additions and 14 deletions

View file

@ -1,2 +1,18 @@
# DonsolJavascript
Javascript version of Donsol
### Original authors
The original Javascript+Electron version of Donsol was created by Hundred Rabbits.
### About this branch
This branch ("web") will be used for development on the web-based version of Donsol, which in turn is heavily based on the main branch, stripping out parts related to Electron and NodeJS.
None of this is official; it's a passion project, so please do not contact Hundred Rabbits regarding issues with this web version of the game.
### Limitations
In the project's current state, you can play the base game of Donsol, with some limitations.
The following do not currently work:
* Card faces do not render properly, as these were previously loaded with NodeJS functions that aren't available to use in a pure browser-based application (as far as I'm aware). I have an idea on how to accomplish this.
* Aspects of the game that relied on being selected from a menu in the Electron version currently have no way of being toggled. These include things like difficulty selection and themeing support.
### Contributing
If you wish to contribute to the project, please follow the standard practice of forking this repository and submitting a pull request.

View file

@ -44,9 +44,6 @@
</div>
</div>
<script type="text/javascript">
const {dialog,app} = require('electron').remote;
const fs = require('fs');
let donsol = new Donsol();
donsol.controller.add("default","*","About",() => { require('electron').shell.openExternal('https://github.com/hundredrabbits/Donsol'); },"CmdOrCtrl+,");
@ -76,8 +73,6 @@
donsol.controller.add("default","Theme","Reset Theme",() => { donsol.theme.reset(); },"CmdOrCtrl+Shift+Backspace")
donsol.controller.add("default","Theme","Download Themes..",() => { require('electron').shell.openExternal('https://github.com/hundredrabbits/Themes'); })
donsol.controller.commit();
donsol.install(document.body)
donsol.start();
</script>

View file

@ -26,7 +26,6 @@ function Card (sym, value, type, name = 'Unknown') {
const graphic = document.createElement('div')
graphic.className = 'graphic'
graphic.innerHTML = require('fs').readFileSync(`${__dirname}/media/${this.type}/${this.value}.svg`)
face.appendChild(graphic)
// Name

View file

@ -4,8 +4,6 @@ function Controller () {
this.menu = { default: {} }
this.mode = 'default'
this.app = require('electron').remote.app
this.start = function () {
}
@ -45,10 +43,6 @@ function Controller () {
return f
}
this.commit = function () {
this.app.inject_menu(this.format())
}
this.docs = function () {
console.log('Generating docs..')
const svg = this.generate_svg(this.format())
@ -181,5 +175,3 @@ function Controller () {
{ x: 540, y: 240, width: 90, height: 60, name: 'alt' }
]
}
module.exports = new Controller()