12 Commits

Author SHA1 Message Date
ff8a9fbc54 Fix vertically misaligned text in Javascript puzzles.
When I constructed my test canvas to measure the vertical extent of a
text string for ALIGN_VCENTRE, I forgot to ensure that the 'width'
variable was an integer, as a result of which the loop over canvas
pixels kept trying to use fractional array indices and returning
undefined :-)

[originally from svn r10196]
2014-06-21 17:40:29 +00:00
c0fff857fd Add a draggable resize handle to the JS puzzles.
Rather than design an ersatz 'window frame' surrounding the puzzle
canvas, I've simply overlaid the resize handle on the corner of the
puzzle itself (canvas or status bar, depending on whether the latter
exists), trusting that all games in my collection provide a reasonable
border within their drawing area. (OS X already does this with its
resize handle, so it's not as if there's no precedent.)

Unlike the desktop versions, I control the resize behaviour completely
in this environment, so I can constrain the canvas to only ever be
sensible sizes with no dead space round the edges (and, in particular,
preserve the aspect ratio).

Right-clicking the resize handle will restore the puzzle's default
tile size. I had intended to implement a maximise-to-browser-window
button too, but was annoyingly foiled by scrollbars - if you maximise
to the current window width, and as a result the text below the puzzle
scrolls off the bottom, then a vertical scrollbar appears and eats
into the width you just maximised to. Gah.

[originally from svn r9822]
2013-04-07 10:24:37 +00:00
36f35f5db8 Regretfully remove my trickery with a hidden <option> element inside
the game-type <select>, since IE turns out to ignore display:none on
options. Oh well.

Instead I now do a more transparent thing: when custom game params are
in use, there's a "Custom" option selected in the dropdown, and a
separate 'Re-customise' option which brings the config box back up.
When an ordinary preset is selected, the Custom option is missing, and
there's just a 'Customise'.

In the process I've tinkered a bit to arrange that the custom 'preset'
is always represented by a negative number rather than one past the
last real preset; that seems more consistent overall.

[originally from svn r9811]
2013-04-05 15:49:29 +00:00
5dc559c8be Assorted HTML/CSS fiddlings to make things work better in IE. I've
added a trivial doctype (IE complained without it), but that caused a
gap to appear between the puzzle and the status bar, so I tinkered a
bit more and ended up removing the <table> completely (no great loss)
as well as adding display:block to the canvas and explicitly setting
the width of not only the status bar div but also its parent div.
Meanwhile, I'm putting the "px" on the end of a lot of properties I
set from JS, because IE complains about that too if I don't.

[originally from svn r9809]
2013-04-05 15:49:25 +00:00
841c9318f3 Remove trailing commas at the ends of initialiser lists. IE 8 and 9
didn't like them, which doesn't matter as such since they won't run
these JS puzzles anyway (no TypedArray support) but it hints that
other JS implementations might be picky about this too.

[originally from svn r9804]
2013-04-05 15:49:19 +00:00
3bc0e5cc24 Clarify header comments in the Emscripten frontend's source files to
mention that the HTML pages generated by html/jspage.pl are also an
integral part of this front end. (The NestedVM frontend is more
self-contained, needing only an appropriate <applet> tag, but this one
expects quite a few components to exist on the page and have the right
ids.)

[originally from svn r9803]
2013-04-05 15:49:18 +00:00
742cf3a443 A UI suggestion from Ben: label the Custom element in the dropdown
with a trailing "..." to hint that it opens a further dialog box.
However, the _invisible_ Custom option is merely indicating what you
_do_ have selected, so we leave that one as it is. (So now they're no
longer exact twins of each other, of course.)

[originally from svn r9796]
2013-03-31 18:36:03 +00:00
75137adf8c Oops. I consistently misspelled my desired lineCap and lineJoin values
as "1" rather than "round". Must have had my Postscript brain in,
and/or been confused by lineWidth = "1" just beforehand. This fixes a
display glitch in Towers, where there's a tiny spike at the top left
corner of each tower due to a very sharp mitred line join.

[originally from svn r9791]
2013-03-31 09:58:48 +00:00
2d2afe9ad4 Fix a crash when changing presets in Inertia. Turns out that my
Javascript-side blitter creation function had forgotten to return the
new blitter's id, so the C code was still trying to use blitter #0
after it had been thrown away and replaced.

[originally from svn r9790]
2013-03-31 09:58:47 +00:00
9826ecd5c3 Apply a bodge to arrange that if the user selects Custom from the game
type dropdown, we still get an 'onchange' event if they select it a
second time. Normally this wouldn't happen, because onchange means
what it says and we only get it if a _different_ element is selected.

My solution is to create two list items called Custom, set one of them
as display:none to stop it showing up when the list is dropped down,
and to select it after the configuration box closes.

[originally from svn r9788]
2013-03-31 09:58:46 +00:00
3e39f6b80b Stop using the dangerously unescaped 'innerHTML' for <option>
contents; use document.createTextNode like I do everywhere else.

[originally from svn r9787]
2013-03-31 09:58:45 +00:00
49fba922ea New front end! To complement the webification of my puzzles via Java
applets, here's an alternative webification in Javascript, using
Emscripten in asm.js mode (so that as browsers incorporate asm.js
optimisation, the game generation should run really fast).

[originally from svn r9781]
2013-03-30 20:16:21 +00:00