simon-git: puzzles (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Tue Sep 5 21:16:32 BST 2017


TL;DR:
  5e53ec5 Organise the JS menus/buttons bar more like a menu.
  b31ea22 Factor some HTML dialog functions out of emcclib.
  1bf591a Support for saving games in Javascript puzzles.
  721119e Support for loading games in Javascript puzzles.
  b36298a Make the images on the web page link to the JS puzzles.

Repository:     https://git.tartarus.org/simon/puzzles.git
On the web:     https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2017-09-05 21:16:32

commit 5e53ec5e36de0485467cb9553b8fa0bb580dc403
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=5e53ec5e36de0485467cb9553b8fa0bb580dc403;hp=afc2134d26ef3bf05852b3e4413565becc1f0b1e
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Sep 5 07:06:48 2017 +0100

    Organise the JS menus/buttons bar more like a menu.
    
    I'm about to introduce a few more options, and the button bar is
    already a bit wide, so I think I should shrink it horizontally before
    putting more stuff on it. So I've organised the options into something
    more like the Game and Type submenus that the desktop versions use.
    
    However, I haven't gone quite all the way, on the basis that the web
    versions will be at least slightly playable on devices without much
    keyboard, which makes it worth keeping the in-play actions (Undo,
    Redo, and to a lesser extent Restart and Solve) accessible as
    top-level buttons in a single click each.
    
    As part of this change, I've also separated the menu bar into a
    drop-down menus section and a top-level buttons section with a gap
    between them, and put a signalling "..." on the end of the titles in
    the former section.
    
    This change also removes the class="left" on the game-type menu and
    its submenus, which were previously there to deal with that menu being
    all the way over on the far right of the menu bar. But the CSS for
    those classes is still there in jspage.pl, and should still work if I
    need it again in future.

 emcclib.js     |  1 -
 html/jspage.pl | 22 +++++++++++++++++-----
 2 files changed, 17 insertions(+), 6 deletions(-)

commit b31ea221673a8f49a383a4a119d6edaabd39642d
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=b31ea221673a8f49a383a4a119d6edaabd39642d;hp=5e53ec5e36de0485467cb9553b8fa0bb580dc403
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Sep 5 20:09:56 2017 +0100

    Factor some HTML dialog functions out of emcclib.
    
    I'm about to want to call these from Javascript as well as from
    Emscripten-compiled C, so I need versions of them that aren't wrapped
    up in the Emscripten library object and also don't expect half their
    parameters to be Emscripten-verse char pointers requiring calls to
    Pointer_stringify.
    
    The easiest way to achieve all of that is to turn the Emscripten-
    ready versions of those functions in emcclib.js into tiny wrappers
    around the JS versions, which do the pointer stringification and a
    couple of other details like directing callbacks to the right C
    functions.

 emcclib.js | 64 +++++++-----------------------------------------------------
 emccpre.js | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 57 deletions(-)

commit 1bf591a5735068d1853be13c5a4255962835d5fe
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=1bf591a5735068d1853be13c5a4255962835d5fe;hp=b31ea221673a8f49a383a4a119d6edaabd39642d
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Sep 5 20:10:16 2017 +0100

    Support for saving games in Javascript puzzles.
    
    This is done by getting midend_serialise to produce the complete
    saved-game file as an in-memory string buffer, and then encoding that
    into a data: URI which we provide to the user as a hyperlink in a
    dialog box. The hyperlink has the 'download' attribute, which means
    clicking on it should automatically offer to save the file, and also
    lets me specify a not-too-silly default file name.

 emcc.c         | 43 +++++++++++++++++++++++++++++++++++++++++++
 emccpre.js     | 26 ++++++++++++++++++++++++++
 emccx.json     |  3 +++
 html/jspage.pl |  1 +
 4 files changed, 73 insertions(+)

commit 721119e4a61cbb261b456dfd134811d7beb5ce98
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=721119e4a61cbb261b456dfd134811d7beb5ce98;hp=1bf591a5735068d1853be13c5a4255962835d5fe
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Sep 5 20:48:42 2017 +0100

    Support for loading games in Javascript puzzles.
    
    This is done by showing a dialog containing an <input type="file">
    through which the user can 'upload' a save file - though, of course,
    the 'upload' doesn't go to any HTTP server, but only into the mind of
    the Javascript running in the same browser.
    
    It would be even nicer to support drag-and-drop as an alternative UI
    for getting the save file into the browser, but that isn't critical to
    getting the first version of this feature out of the door.

 emcc.c         | 38 ++++++++++++++++++++++++++++++++++++--
 emccpre.js     | 26 ++++++++++++++++++++++++++
 emccx.json     |  3 ++-
 html/jspage.pl |  1 +
 4 files changed, 65 insertions(+), 3 deletions(-)

commit b36298ab4d3e52868d115afca0e26b310eeb06dc
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=b36298ab4d3e52868d115afca0e26b310eeb06dc;hp=721119e4a61cbb261b456dfd134811d7beb5ce98
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Sep 5 21:02:18 2017 +0100

    Make the images on the web page link to the JS puzzles.
    
    I've been thinking for a while that it's about time I did that. Those
    images used to link to the Java versions of the puzzles, back when
    Java was the in-browser applet platform of choice; then I made them
    not link to either one when it wasn't clear which system would win;
    but now JS has clearly won, it's past time the images linked to the JS
    puzzles, as the obviously sensible default.

 webpage.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)



More information about the tartarus-commits mailing list