Skip to content

Commit

Permalink
Merge pull request #5 from chanceagency/master
Browse files Browse the repository at this point in the history
Update to latest Inkle master, adds latest Neo Cab tags to our tag linter
  • Loading branch information
awmcclain authored Aug 13, 2018
2 parents e5b9e58 + 94706e2 commit 122b104
Show file tree
Hide file tree
Showing 39 changed files with 4,296 additions and 6,355 deletions.
16 changes: 6 additions & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,13 @@
"args": [],
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/app/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceRoot}/app/node_modules/.bin/electron.cmd"
},
"runtimeArgs": [
"app/",
// "--enable-logging"
],
"env": {"ELECTRON_ENABLE_LOGGING": "1"},
//"externalConsole": true,
"runtimeArgs": [/*
".",
"--enable-logging"
*/],
"env": {},
"console": "integratedTerminal",
"sourceMaps": false,
//"outDir": null
},
{
"name": "Electron: Renderer",
Expand Down
79 changes: 77 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,84 @@
This is McSlinky, Robin & Andrew's lightly customized version of Inky!
This is McSlinky, Chance Agency's customized version of Inky!

We made this to help us write Neo Cab, and so a lot of our changes from the original Inky may not be beneficial for the game you're making. But take a look around and borrow freely if something seems helpful!

McSlinky is just a small set of extensions on top of Inkle's fantastic Inky editor. Contributors include:
@robinsloan, @hoverbird, @amc, @gingeranyhow and @notbrunoagain

![](resources/icon-small.jpg)

You'll probably want to refer to the original Inky README [here](https://github.com/inkle/inky).


[Download the latest release](http://www.github.com/inkle/inky/releases/latest)

## Implementation details

Inky is built using:

* [Electron](http://electron.atom.io/), a framework by GitHub to build cross-platform Desktop app using HTML, CSS and JavaScript.
* [Ace](https://ace.c9.io/#nav=about), a full-featured code editor built for the web.
* [Photon](http://photonkit.com/), for some of the components. However, the dependency could probably be removed, since its only used for small portions of the CSS.

Inky includes a copy of **inklecate**, the command line **ink** compiler.

## Help develop Inky!

Take a look at the [issues page](https://github.com/inkle/inky/issues) for an issue with a "help wanted" label. We try to provide some basic instructions on how to get started with the development of the feature whenever we add the label.

To build the project:

* Install [node.js](https://nodejs.org/en/) if you don't already have it
* Clone the repo
* On Mac, double-click the `INSTALL_AND_RUN.command` script. On Windows, open Powershell, cd into the app directory, and type `npm install`, then `npm start`.
* For subsequent runs, if no npm packages have changed, you can run the `RUN.command` script on Mac, or type `npm start` in the shell (on Windows).

### Linux

Tested on a fresh **Ubuntu 16.04 LTS** VM installation (_equivalent processes should work for other distributions_)

* Install build tools

`sudo apt-get install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r)`

* Pre-requisites

`sudo apt install git`

`sudo apt install curl`

* Install node and npm

`curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -`

`sudo apt-get install -y nodejs`

* Install mono as per http://www.mono-project.com/download/stable/#download-lin

`sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF`

`echo "deb http://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list`

`sudo apt-get update`

`sudo apt-get install mono-complete`

* Clone the inky repo

`git clone https://github.com/chanceagency/mcslinky.git`

* Test inklecate_win with mono (_should output usage info_)

`mono app/main-process/ink/inklecate_win.exe`

* Install and run inky

`./INSTALL_AND_RUN.command`

* For subsequent runs, if no npm packages have changed, launch inky as below (otherwise re-run previous step):

`./RUN.command`

## License

**McSlinky**, like Inky, is released under the MIT license.
Expand All @@ -21,6 +96,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

*Inky is named after a black cat based in Cambridge, UK.*

*Soy Inky is named after soy ink, which is made from soy beans. It's the kind of ink Robin uses with his Risograph.*
*Soy Inky was named after soy ink, which is made from soy beans. It's the kind of ink Robin uses with his Risograph.*

*McSlinky is named, well, for vanity.*
3 changes: 2 additions & 1 deletion TEST_RELEASE_BUILD.command
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
cd "`dirname "$0"`"
mocha
cd app
npm test
10 changes: 6 additions & 4 deletions app/linter/ink-linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ let charTagsNoParam = {
}

let storyTags = {
tags: ['car', 'pause', 'setRide', 'cutCamera', 'lighting', 'sfx'],
tags: ['car', 'pause', 'setRide', 'cutCamera', 'lighting', 'sfx', 'rideEnded', 'linaHands'],
linter: hasStoryTagError,
needsParam: true,
validParams: {
cutCamera: ['linapov', 'paxleft', 'paxright', 'dashcam', 'hoodcam', 'linafront', 'city']
cutCamera: ['linapov', 'paxleft', 'paxright', 'dashcam', 'hoodcam', 'linafront', 'city'],
linaHands: ['checkwatch']
}
}

Expand Down Expand Up @@ -102,9 +103,10 @@ let tagsWithoutEvents = {
"DropoffLocation",
"DropoffNeighborhood",
"disabled",
"tester",
"fuelPreview",
"UIView",
/* "pause",*/ // This is in the story tag list. Confirm with patrick.
"distance",
"distance"
],
validParams: {}
};
Expand Down
5 changes: 4 additions & 1 deletion app/main-process/aboutWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const electronWindowOptions = {
width: 340,
height: 270,
resizable: false,
title: "About Inky"
title: "About Inky",
show: false
};

const versionFilePath = "ink/version.txt";
Expand Down Expand Up @@ -43,6 +44,8 @@ function AboutWindow() {
"inkVersion": inkVersion,
"inkjsVersion": inkjsPackage.version
});
w.setMenu(null);
w.show();
});

this.browserWindow = w;
Expand Down
21 changes: 18 additions & 3 deletions app/main-process/appmenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ function setupMenus(callbacks) {
type: "checkbox",
checked: true,
click: callbacks.toggleTags
},
{
label: 'Count words',
enabled: callbacks.isFocusedWindow,
click: callbacks.countWords
}
]
},
Expand Down Expand Up @@ -217,14 +222,15 @@ function setupMenus(callbacks) {
},
];

const name = app.getName();
const aboutWindowLabel = 'About ' + name;
// Mac specific menus
if (process.platform === 'darwin') {
const name = app.getName();
template.unshift({
label: name,
submenu: [
{
label: 'About ' + name,
label: aboutWindowLabel,
click: callbacks.showAbout
// role: 'about'
},
Expand Down Expand Up @@ -300,7 +306,16 @@ function setupMenus(callbacks) {
);
console.log(fileMenu);
}

else
{
// Windows specific menu items
template.find(x => x.label === "Help").submenu.push(
{
label: aboutWindowLabel,
click: callbacks.showAbout
}
);
}

const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
Expand Down
Binary file modified app/main-process/ink/ink-engine-runtime.dll
Binary file not shown.
Binary file modified app/main-process/ink/ink-engine-runtime.dll.mdb
Binary file not shown.
Binary file added app/main-process/ink/ink_compiler.dll
Binary file not shown.
Binary file added app/main-process/ink/ink_compiler.dll.mdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions app/main-process/ink/inkjs-compatible/inkjs-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
inkjs is currently: 1.6.0
compatible with ink: 0.7.5 + 32fa48a251826d82b9e4e36b04f147bf577a05e5

..which is the version of inklecate in this folder.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified app/main-process/ink/inklecate.exe.mdb
Binary file not shown.
2 changes: 2 additions & 0 deletions app/main-process/ink/inklecate_linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
/usr/bin/mono inklecate_win.exe "$@"
Binary file modified app/main-process/ink/inklecate_mac
Binary file not shown.
Binary file modified app/main-process/ink/inklecate_win.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion app/main-process/ink/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.4
0.8.1 (with latest changes from master)
26 changes: 21 additions & 5 deletions app/main-process/inklecate.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const linter = require('../linter/ink-linter.js');
const inklecateNames = {
"darwin": "/ink/inklecate_mac",
"win32": "/ink/inklecate_win.exe",
"linux": "/ink/inklecate_win.exe"
"linux": "/ink/inklecate_linux"
}
const inklecateRootPathRelease = path.join(__dirname, "../../app.asar.unpacked/main-process");
const inklecateRootPathDev = __dirname;
Expand Down Expand Up @@ -76,8 +76,15 @@ function compile(compileInstruction, requester) {

inklecateOptions.push(mainInkPath);

const playProcess = spawn(inklecatePath, inklecateOptions, {
"cwd": path.dirname(inklecatePath),
var inklecatePathToUse = inklecatePath;
if( compileInstruction.inkJsCompatible ) {
var inklecateName = path.basename(inklecatePath);
var inklecateFolderName = path.dirname(inklecatePath);
inklecatePathToUse = path.resolve(inklecateFolderName, "inkjs-compatible", inklecateName);
}

const playProcess = spawn(inklecatePathToUse, inklecateOptions, {
"cwd": path.dirname(inklecatePathToUse),
"env": {
"MONO_BUNDLED_OPTIONS": "--debug"
}
Expand Down Expand Up @@ -150,8 +157,8 @@ function compile(compileInstruction, requester) {
for(var i=0; i<lines.length; ++i) {
var line = lines[i].trim();

var choiceMatches = line.match(/^(\d+):\s+(.*)/);
var errorMatches = line.match(/^(ERROR|WARNING|RUNTIME ERROR|TODO): ('([^']+)' )?line (\d+): (.+)/);
var choiceMatches = line.match(/^(\d+):\s*(.*)/);
var errorMatches = line.match(/^(ERROR|WARNING|RUNTIME ERROR|RUNTIME WARNING|TODO): ('([^']+)' )?line (\d+): (.+)/);
var tagMatches = line.match(/^(# tags:) (.+)/);
var promptMatches = line.match(/^\?>/);
var debugSourceMatches = line.match(/^DebugSource: (line (\d+) of (.*)|Unknown source)/);
Expand Down Expand Up @@ -181,6 +188,7 @@ function compile(compileInstruction, requester) {
text: choiceMatches[2]
}, sessionId);
} else if( promptMatches ) {
sendAnyErrors();
if( session.evaluatingExpression )
session.evaluatingExpression = false;
else if( session.justRequestedDebugSource )
Expand Down Expand Up @@ -292,6 +300,14 @@ ipc.on("get-location-in-source", (event, offset, sessionId) => {
}
});

ipc.on("get-runtime-path-in-source", (event, runtimePath, sessionId) => {
if( sessions[sessionId] ) {
const playProcess = sessions[sessionId].process;
if( playProcess )
playProcess.stdin.write("DebugPath "+runtimePath+"\n");
}
});



exports.Inklecate = {
Expand Down
4 changes: 4 additions & 0 deletions app/main-process/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ app.on('ready', function () {
},
showAbout: () => {
AboutWindow.showAboutWindow();
},
countWords: () => {
var win = ProjectWindow.focused();
if (win) win.countWords();
}
});

Expand Down
4 changes: 4 additions & 0 deletions app/main-process/projectWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ ProjectWindow.prototype.tryClose = function() {
this.browserWindow.webContents.send('project-tryClose');
}

ProjectWindow.prototype.countWords = function() {
this.browserWindow.webContents.send('project-count-words');
}

ProjectWindow.prototype.finalClose = function() {
this.safeToClose = true;
Inklecate.killSessions(this.browserWindow);
Expand Down
Loading

0 comments on commit 122b104

Please sign in to comment.