Skip to content

Instantly share code, notes, and snippets.

@ancestral
ancestral / wgo.js
Created July 28, 2012 08:26
Wesnoth Game Object: Game state in JavaScript
/*
* Wesnoth Game Object (WGO)
* by ancestral
*
*
* This is an experiment with writing an entire Wesnoth game, stored in an object.
*
* Yes, if you combine this with Wesnoth Canvas, I guess this means Wesnoth for the
* browser.
*
@ancestral
ancestral / ASCII JS Keyboard Map
Created July 6, 2012 04:33
ASCII keyboard map for JavaScript keycodes (Mac)
/*
* JavaScript Keyboard Map (Mac layout)
*
*
* esc—— F1——— F2——— F3——— F4——— F5——— F6——— F7——— F8——— F9——— F10—— F11—— F12—— F13—————+
* | 27 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | ??? |
* ` ——— 1———— 2———— 3———— 4———— 5———— 6———— 7———— 8———— 9———— 0———— - ——— = ——— delete——+
* | 192 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
* tab———— Q———— W———— E———— R———— T———— Y———— U———— I———— O———— P———— [ ——— ] ——— \ ————+
* | 9 | 81 | 87 | 69 | 82 | 84 | 89 | 85 | 73 | 79 | 80 | 219 | 221 | 220 |
@ancestral
ancestral / wmlreader.js
Created May 14, 2012 04:20
Convert Wesnoth WML file into JSON
/* wmlreader.js
*
* Read a Wesnoth WML file and parse it, save it as a JSON string.
*
* This depends on jQuery to read in the file. If you already have the file as a string
* you can skip readConfigFile() and just use readWML().
*
* This isn’t quite valid JSON. It has duplicate entries. I’ll need to turn those into arrays or something.
*
* last updated 13 May 12