* emcclib.js: one of the Javascript components of an Emscripten-based
* web/Javascript front end for Puzzles.
*
- * The other parts of this system live in emcc.c and emccpre.js.
+ * The other parts of this system live in emcc.c and emccpre.js. It
+ * also depends on being run in the context of a web page containing
+ * an appropriate collection of bits and pieces (a canvas, some
+ * buttons and links etc), which is generated for each puzzle by the
+ * script html/jspage.pl.
*
* This file contains a set of Javascript functions which we insert
* into Emscripten's library object via the --js-library option; this
* case we need to do something special - see below.
*/
js_add_preset: function(ptr) {
- var name = (ptr == 0 ? "Custom" : Pointer_stringify(ptr));
+ var name = (ptr == 0 ? "Custom..." : Pointer_stringify(ptr));
var value = gametypeoptions.length;
var option = document.createElement("option");
// we wouldn't get if the browser thought it was already
// the selected one. But here, it's _not_ the selected
// option already; its invisible evil twin is selected.
+ //
+ // (Actually, they're not _identical_ evil twins: we label
+ // the two slightly differently. The visible one that the
+ // user can select is labelled "Custom..." to hint that it
+ // opens a dialog box, whereas the invisible one that's
+ // left shown after the box closes is just "Custom",
+ // because that's telling you what you _have_ got
+ // selected.)
option = document.createElement("option");
option.value = value;
- option.appendChild(document.createTextNode(name));
+ option.appendChild(document.createTextNode("Custom"));
option.style.display = "none";
gametypeselector.appendChild(option);
gametypehiddencustom = option;
ctx.moveTo(x1 + 0.5, y1 + 0.5);
ctx.lineTo(x2 + 0.5, y2 + 0.5);
ctx.lineWidth = width;
- ctx.lineCap = '1';
- ctx.lineJoin = '1';
+ ctx.lineCap = 'round';
+ ctx.lineJoin = 'round';
ctx.strokeStyle = colour;
ctx.stroke();
ctx.fillStyle = colour;
ctx.fill();
}
ctx.lineWidth = '1';
- ctx.lineCap = '1';
- ctx.lineJoin = '1';
+ ctx.lineCap = 'round';
+ ctx.lineJoin = 'round';
ctx.strokeStyle = Pointer_stringify(outline);
ctx.stroke();
},
ctx.fill();
}
ctx.lineWidth = '1';
- ctx.lineCap = '1';
- ctx.lineJoin = '1';
+ ctx.lineCap = 'round';
+ ctx.lineJoin = 'round';
ctx.strokeStyle = Pointer_stringify(outline);
ctx.stroke();
},
*/
js_focus_canvas: function() {
onscreen_canvas.focus();
- },
+ }
});