-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up electron to build distributables.
- Loading branch information
Showing
5 changed files
with
184 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/.bundle | ||
/.git | ||
/_site | ||
/build | ||
/dist | ||
/ld32 | ||
/node_modules | ||
/promo-art | ||
/raw-assets | ||
*.sublime-* | ||
.bowerrc | ||
.electronignore | ||
.gitignore | ||
Gemfile | ||
Gemfile.lock | ||
README.md | ||
bower.json | ||
packager.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
.bundle/ | ||
_site/ | ||
build/ | ||
dist/ | ||
node_modules/ | ||
*.sublime-workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,74 @@ | ||
# Fatal Attraction | ||
|
||
This is a game I made for Ludum Dare 32. The theme was **An Unconventional Weapon**. | ||
> A game about a close encounter with gravity | ||
## Tools | ||
 | ||
|
||
- [Sublime Text 3](http://www.sublimetext.com/) - IDE | ||
- [Phaser](https://phaser.io/) - Engine | ||
- [Chromium](https://www.chromium.org/) - Browser | ||
- [GIMP](http://www.gimp.org/) - Art | ||
- [Chiptone](http://sfbgames.com/chiptone/) - Audio | ||
- [SunVox](http://www.warmplace.ru/soft/sunvox/) - Audio | ||
This is a game originally made for Ludum Dare 32. The theme was **An Unconventional Weapon**. | ||
|
||
|
||
## Install | ||
|
||
Either play [online](http://erbridge.co.uk/fatal-attraction/) or download the appropriate [distribution for your system](/dist/). | ||
|
||
|
||
## Develop | ||
|
||
This game can be run directly in the browser, or run as a standalone executable using [Electron](http://electron.atom.io). | ||
|
||
|
||
### Web | ||
|
||
Since the site is hosted on GitHub Pages (hence `gh-pages` being the main branch), I use Jekyll when developing it. Any webserver would do, however. | ||
|
||
|
||
#### Install | ||
|
||
``` | ||
$ bundle install --path="./bundle" | ||
``` | ||
|
||
|
||
#### Run | ||
|
||
``` | ||
$ bundle exec jekyll serve --watch | ||
``` | ||
|
||
|
||
### Electron | ||
|
||
#### Install | ||
|
||
``` | ||
$ npm install | ||
``` | ||
|
||
|
||
#### Run | ||
|
||
``` | ||
$ npm start | ||
``` | ||
|
||
|
||
#### Build | ||
|
||
``` | ||
$ npm run build | ||
``` | ||
|
||
|
||
#### Distribute | ||
|
||
``` | ||
$ npm run dist | ||
``` | ||
|
||
|
||
### Assets | ||
|
||
The raw audio assets can be found in `raw-assets/`, and are editable in: | ||
|
||
- `.cpt` - [Chiptone](http://sfbgames.com/chiptone/) | ||
- `.sunvox` - [SunVox](http://www.warmplace.ru/soft/sunvox/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict'; | ||
|
||
const app = require('app'); | ||
const BrowserWindow = require('browser-window'); | ||
const crashReporter = require('crash-reporter'); | ||
|
||
// Report crashes to the Electron project. | ||
crashReporter.start(); | ||
|
||
// Prevent the main window from being GCed. | ||
let mainWindow; | ||
|
||
function onClosed() { | ||
mainWindow = null; | ||
} | ||
|
||
function createMainWindow() { | ||
const win = new BrowserWindow({ | ||
width: 1820, | ||
height: 1024, | ||
resizable: true | ||
}); | ||
|
||
win.loadUrl(`file://${__dirname}/index.html`); | ||
|
||
win.on('closed', onClosed); | ||
|
||
return win; | ||
} | ||
|
||
app.on('window-all-closed', function () { | ||
if (process.platform !== 'darwin') { | ||
app.quit(); | ||
} | ||
}); | ||
|
||
app.on('activate-with-no-open-windows', function () { | ||
if (!mainWindow) { | ||
mainWindow = createMainWindow(); | ||
} | ||
}); | ||
|
||
app.on('ready', function () { | ||
mainWindow = createMainWindow(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "fatal-attraction", | ||
"productName": "FatalAttraction", | ||
"version": "0.2.0", | ||
"description": "A game about a close encounter with gravity", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"repository": "erbridge/fatal-attraction", | ||
"author": { | ||
"name": "Felix Laurie von Massenbach", | ||
"email": "felix@erbridge.co.uk", | ||
"url": "erbridge.co.uk" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"start": "electron .", | ||
"clean": "rm -rf ./build", | ||
"clean:linux": "rm -rf ./build/linux", | ||
"clean:darwin": "rm -rf ./build/darwin", | ||
"clean:win32": "rm -rf ./build/win32", | ||
"build": "npm run build:linux && npm run build:darwin && npm run build:win32", | ||
"build:darwin": "npm run clean:darwin && electron-packager . \"$npm_package_productName\" --out=build/darwin --platform=darwin --arch=x64 --version=0.31.0 --ignore=$(cat .electronignore | sed -e 's-^/-\\^/-g' | tr -s '\\n' | tr '\\n' '|' | sed -e 's/|$//g' -e 's/\\./\\\\\\./g' -e 's/\\*/\\.\\*/g') --prune --asar", | ||
"build:linux": "npm run clean:linux && electron-packager . \"$npm_package_productName\" --out=build/linux --platform=linux --arch=x64 --version=0.31.0 --ignore=$(cat .electronignore | sed -e 's-^/-\\^/-g' | tr -s '\\n' | tr '\\n' '|' | sed -e 's/|$//g' -e 's/\\./\\\\\\./g' -e 's/\\*/\\.\\*/g') --prune --asar", | ||
"build:win32": "npm run clean:win32 && electron-packager . \"$npm_package_productName\" --out=build/win32 --platform=win32 --arch=x64 --version=0.31.0 --ignore=$(cat .electronignore | sed -e 's-^/-\\^/-g' | tr -s '\\n' | tr '\\n' '|' | sed -e 's/|$//g' -e 's/\\./\\\\\\./g' -e 's/\\*/\\.\\*/g') --prune --asar", | ||
"dist": "npm run dist:linux && npm run dist:darwin && npm run dist:win32", | ||
"dist:darwin": "npm run build:darwin && mkdir -p \"dist/darwin-$npm_package_version\" && tar -czf \"dist/darwin-$npm_package_version/$npm_package_productName-darwin-x64-$npm_package_version.tar.gz\" -C build/darwin/ \"$npm_package_productName-darwin-x64\"", | ||
"dist:linux": "npm run build:linux && mkdir -p \"dist/linux-$npm_package_version\" && tar -czf \"dist/linux-$npm_package_version/$npm_package_productName-linux-x64-$npm_package_version.tar.gz\" -C build/linux/ \"$npm_package_productName-linux-x64\"", | ||
"dist:win32": "npm run build:win32 && mkdir -p \"dist/win32-$npm_package_version\" && pushd build/win32 && zip -q -r \"../../dist/win32-$npm_package_version/$npm_package_productName-win32-x64-$npm_package_version.zip\" \"$npm_package_productName-win32-x64\" && popd" | ||
}, | ||
"files": [ | ||
"assets/", | ||
"css/", | ||
"js/", | ||
"lib/", | ||
"index.js", | ||
"index.html", | ||
"LICENSE" | ||
], | ||
"keywords": [ | ||
"electron-app" | ||
], | ||
"devDependencies": { | ||
"electron-packager": "^5.0.2", | ||
"electron-prebuilt": "^0.31.0" | ||
} | ||
} |