aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
* Add a draggable resize handle to the JS puzzles.Simon Tatham2013-04-07
| | | | | | | | | | | | | | | | | | | | | | | 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]
* Fix a typo I noticed in passing.Simon Tatham2013-04-07
| | | | [originally from svn r9821]
* Add a new midend function to reset the tile size to the puzzle'sSimon Tatham2013-04-07
| | | | | | | default (but still counting the <puzzle>_TILESIZE user preference environment variables, where available). [originally from svn r9820]
* Small refactor to relative_mouse_coords: now the functionality whichSimon Tatham2013-04-07
| | | | | | | returns an element's absolute position on the web page is split out into a subfunction that can be called directly. [originally from svn r9819]
* Fix the 'puzzle doesn't work' apology, which I'd accidentally movedSimon Tatham2013-04-06
| | | | | | | | | | | | | | inside the top-level display:none puzzle container as a side effect of r9809. Also, while I'm at it, reword the apology to mention typed arrays as the most likely cause of failure (AFAIK that's the most modern feature required by the JS front end), and fix indecision between singular and plural ('this puzzle' doesn't work, perhaps a feature 'they depend on' is missing). [originally from svn r9818] [r9809 == 5dc559c8be1b8f6ed15f560433f25c952c874f93]
* Don't forget to NULL out the new game id notification callback, orSimon Tatham2013-04-06
| | | | | | | else it might start off accidentally initialised to nonsense in front ends which don't use it. [originally from svn r9817]
* Mention Safari in the list of tested browsers.Simon Tatham2013-04-05
| | | | [originally from svn r9816]
* Update the list of tested browsers.Simon Tatham2013-04-05
| | | | [originally from svn r9812]
* Regretfully remove my trickery with a hidden <option> element insideSimon Tatham2013-04-05
| | | | | | | | | | | | | | | | | 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]
* Rewrite the JS keyboard handling to cope with IE and Chrome.Simon Tatham2013-04-05
| | | | | | | | | | Unlike Firefox, IE and Chrome don't generate keypress events at all if you suppress the default handling of keydowns. Therefore, we have to figure out everything from the keydown event, because if we unsuppress the default handling of any keydowns then we'll get annoyances like ^R going back to meaning reload-page rather than redo-move. [originally from svn r9810]
* Assorted HTML/CSS fiddlings to make things work better in IE. I'veSimon Tatham2013-04-05
| | | | | | | | | | | | 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]
* Stop accidentally subtracting onscreen_canvas.offset{Left,Top} fromSimon Tatham2013-04-05
| | | | | | | | the return value of relative_mouse_coords! I only got away with that error because the canvas was at offset zero compared to its immediate parent element. [originally from svn r9808]
* Implement debug_printf() in the Emscripten front end, since that's theSimon Tatham2013-04-05
| | | | | | easiest way to call js_debug with formatted parameters. [originally from svn r9807]
* IE doesn't default to giving focus to the puzzle canvas on a mouseSimon Tatham2013-04-05
| | | | | | | click, so manually implement that behaviour. (Without it, it's quite hard to focus the canvas at all in IE.) [originally from svn r9806]
* I've just realised that the JS puzzles' permalinks were not updatingSimon Tatham2013-04-05
| | | | | | | | | | | | | | | when the user pressed 'n' for a new game, because all the front end knows is that it passed a keystroke to the puzzle, and it has no way of hearing back that a particular keypress resulted in a game id change. To fix this, I've renamed midend_request_desc_changes to midend_request_id_changes and expanded its remit to cover _any_ change to the game ids. So now that callback in the Emscripten front end is the only place from which update_permalinks is called (apart from initialising them at setup time), and that should handle everything. [originally from svn r9805]
* Remove trailing commas at the ends of initialiser lists. IE 8 and 9Simon Tatham2013-04-05
| | | | | | | | 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]
* Clarify header comments in the Emscripten frontend's source files toSimon Tatham2013-04-05
| | | | | | | | | | 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]
* Try to give a more friendly message if anything goes wrong duringSimon Tatham2013-04-03
| | | | | | | | | | puzzle startup. The puzzle web pages now enclose the whole puzzle (buttons, canvas, permalinks) in a div set to display:none, and instead display an apologetic message saying 'sorry, it didn't work'; then, if we get through the whole init function without crashing, we show the puzzle and hide the apology. [originally from svn r9802]
* Fix a grammatical confusion on the Unruly web page.Simon Tatham2013-04-02
| | | | [originally from svn r9801]
* Rewrite trim_rect() for robustness.Simon Tatham2013-04-01
| | | | | | | | | | | | The previous version dealt adequately with rectangles _partially_ overlapping the edge of the canvas, but doesn't correctly handle a rectangle that's completely out of bounds in one direction. Replace with a complete rewrite which is more easily seen to be correct. Also, while I'm at it, add a missing condition to draw_update() so that we don't even bother calling the Javascript half of it on any rectangle that's been trimmed into nonexistence. [originally from svn r9800]
* Greg Hewgill points out a code path on which the angle parameter toSimon Tatham2013-04-01
| | | | | | the Penrose grid generation function can fail to be initialised. [originally from svn r9798]
* Fix the icon makefile in the wake of r9795.Simon Tatham2013-03-31
| | | | | [originally from svn r9797] [r9795 == 3fc5a644a72e747b1f88125b38b2f178a9bc7ed3]
* A UI suggestion from Ben: label the Custom element in the dropdownSimon Tatham2013-03-31
| | | | | | | | | 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]
* Undead was not ever actually draw_update()ing to the edges of itsSimon Tatham2013-03-31
| | | | | | | | | | rectangle, which showed up on the Javascript front end since the JS canvas doesn't start out defaulting to COL_BACKGROUND. Fixed it to draw_update to the edge of its area, and while I'm at it, narrowed the border (since this proves we didn't really need that much space anyway). [originally from svn r9795]
* Make sure the right element of the game-type dropdown starts offSimon Tatham2013-03-31
| | | | | | | | | | | | selected. Previously we were leaving the first element on the list selected, which is _usually_ right, but not right for Slant. In the process of doing this, I've also reorganised to fix a crash which shows up with non-configurable games (admittedly currently only Nullgame :-) when we still try to call js_select_preset in spite of not having any preset options to select. [originally from svn r9794]
* Introduce a mechanism by which calls to midend_supersede_game_desc()Simon Tatham2013-03-31
| | | | | | | can trigger a call to a front end notification function. Use this to update the game ID permalink when Mines supersedes its game ID. [originally from svn r9793]
* Reinstate a missing semicolon.Simon Tatham2013-03-31
| | | | [originally from svn r9792]
* Oops. I consistently misspelled my desired lineCap and lineJoin valuesSimon Tatham2013-03-31
| | | | | | | | | 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]
* Fix a crash when changing presets in Inertia. Turns out that mySimon Tatham2013-03-31
| | | | | | | | 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]
* Don't forget to restore the correct selection in the dropdown list ifSimon Tatham2013-03-31
| | | | | | the user cancels a configuration dialog. [originally from svn r9789]
* Apply a bodge to arrange that if the user selects Custom from the gameSimon Tatham2013-03-31
| | | | | | | | | | | | 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]
* Stop using the dangerously unescaped 'innerHTML' for <option>Simon Tatham2013-03-31
| | | | | | contents; use document.createTextNode like I do everywhere else. [originally from svn r9787]
* Forgot to make the web-page-building scripts executable.Simon Tatham2013-03-31
| | | | [originally from svn r9786]
* New front end! To complement the webification of my puzzles via JavaSimon Tatham2013-03-30
| | | | | | | | 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]
* Introduce a mechanism in this source tree for building the containerSimon Tatham2013-03-30
| | | | | | | | | | | | | | | | | | | | web pages for the Java applets. Previously, those have all been maintained by hand in my website's svn area, which is a bit silly. Now we have a file per puzzle in the 'html' subdirectory which contains the puzzle's name, one or two attributes, and the instructions snippet to go below the puzzle applet; and then there's a Perl script that builds all the real web pages out of that by adding in the parts common across all files: the header, footer, and middle fragment with the <applet> tag and resizing bits and pieces. One piece _not_ checked in here is the footer text specific to my hosting at chiark, which I think does still belong in the www area. So Buildscr doesn't actually build the web pages; it just delivers the bits and pieces by which my nightly snapshot script will be able to run the program that _does_ build them, passing that footer as an extra argument. [originally from svn r9780]
* Edit the paragraph in the midend_deserialise() docs which I forgot toSimon Tatham2013-03-30
| | | | | | | | fix in r9777 when I added documentation of the function it wistfully imagined might one day exist. [originally from svn r9779] [r9777 == 1fdafb6abf2d3ea0d37e79b5dfd9daf8eed28f22]
* Add a midend function to return the current random seed, parallel toSimon Tatham2013-03-30
| | | | | | | the existing one that returns the game id. No front end has so far needed this, but one is about to. [originally from svn r9778]
* Add documentation for the identify_game() function which I introducedSimon Tatham2013-03-30
| | | | | | | in r9749 and forgot to write up. [originally from svn r9777] [r9749 == 6b6442b16c5de9f5f9479b736bf865a4236047cb]
* Found a bug in nullgame! Its vestigial game_redraw lacked aSimon Tatham2013-03-30
| | | | | | | draw_update, which isn't really setting a good example for people cloning it :-) Add the missing draw_update call. [originally from svn r9776]
* Remove a redundant and also erroneous memset.Simon Tatham2013-03-11
| | | | | | | | | (If you're going to memset a struct to 0 before filling in the fields you care about, do use sizeof the struct rather than sizeof the pointer; but also, if you're filling in _every_ field, there's no need to bother anyway.) [originally from svn r9773]
* Clarify instructions for 'Range' -- I initially read the last point asJacob Nevins2013-03-10
| | | | | | | meaning the maximum white squares in any direction, rather than the total of all directions. [originally from svn r9771]
* Make Unruly's keyboard controls match the documentation and other puzzles inJacob Nevins2013-03-10
| | | | | | the collection -- now Enter = black and Space = white. [originally from svn r9770]
* Fix entering pencil marks from the keyboard; the cursor is no longer removedJacob Nevins2013-03-10
| | | | | | (this brings Undead into line with Solo, etc). [originally from svn r9769]
* Stop using CLUE2CHAR to translate clues into text; just do the obviousSimon Tatham2013-02-24
| | | | | | | | sprintf in both locations (screen and print) that need it. Fixes a bug in which clues greater than 9 came out as hex digits in printed puzzles. [originally from svn r9765]
* Stop the analysis pass in Loopy's redraw routine from beingSimon Tatham2013-01-19
| | | | | | | | | | | | | | | | | | conditionalised on !ds->started, so that we still do all the looping over everything even if we know it's all going to be redrawn. This is because deciding how much needs redrawing is not the only important thing in those loops - they also set up arrays like ds->clue_error, which tell the individual redraw functions _what_ to draw. Fixes a bug in which, if you start a Loopy game and make moves causing a clue to light up red for an error and then save your game, loading the same save file at the start of a Loopy run would fail to highlight the erroneous clue. (This commit diff looks large, but actually it changes almost nothing but whitespace.) [originally from svn r9751]
* Bring Pearl's game-completion handling in line with my usual practice:Simon Tatham2013-01-19
| | | | | | | | | the 'completed' flag is not reset if you make a new move transforming a solved game into an unsolved state, so the game won't flash again if you manually erase and redraw a line segment (though it still will if you undo and redo past the first solved state in the undo history). [originally from svn r9750]
* Revamp of the Windows command-line parsing and puzzle-loading code.Simon Tatham2013-01-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The Windows puzzles now accept similar command-line syntax to the GTK ones, in that you can give them either a game ID (descriptive, random or just plain params) or the name of a save file. Unlike the GTK ones, however, the save file interpretation is tried first; this is because some puzzles (e.g. Black Box) will interpret any old string as a valid (if boring) game ID, and unlike the GTK puzzles it's not feasible to require users to disambiguate via a command-line option, because on Windows a thing that might easily happen is that a user passes a save file to a puzzle binary via 'Open With' in the GUI shell, where they don't get the chance to add extra options. In order to make this work sensibly in the all-in-one Windows app, I had to get round to another thing I've been planning to do for a while, which is to write a function to examine a saved game file and find out which puzzle it's for. So the combined Windows binary will auto-switch to the right game if you pass a save file on its command line, and also if you use Load while the program is running. Another utility function I needed is one to split the WinMain single command line string into argv. For this I've imported a copy of split_into_argv() from Windows PuTTY (which doesn't affect this package's list of copyright holders, since that function was all my own code anyway). [originally from svn r9749]
* Pattern's display was broken for non-square puzzles, becauseSimon Tatham2013-01-09
| | | | | | | | draw_numbers() was considerably confused between the width of the clue border at the left and the height of the clue border at the top. Unconfuse it (I think). [originally from svn r9737]
* Actually do what the comment says at the top of main() regarding notSimon Tatham2012-12-28
| | | | | | | | bombing out due to an option that we don't recognise but GTK will. Somehow my basically workable plan had been completely nullified by putting the error check in the wrong place. [originally from svn r9733]
* Fix overnight build failure last night, by making the new call toSimon Tatham2012-11-21
| | | | | | | | | | | | gtk_widget_get_allocation conditional on GTK being new enough to have that function. I'm assuming until someone proves otherwise that if it isn't that new, then it also isn't one of the versions of GTK which exhibit the bug which that call was working around (since gtk_widget_get_allocation came in 2.18, and the problem seems to have arisen since 2.20). [originally from svn r9712]