aboutsummaryrefslogtreecommitdiff
path: root/windows.c (follow)
Commit message (Collapse)AuthorAge
...
* HTML Help support for Puzzles, with the same kind of automaticSimon Tatham2006-12-24
| | | | | | fallback behaviour as PuTTY's support. [originally from svn r7009]
* Cleanup: relieve frontends of the duty to callSimon Tatham2005-10-22
| | | | | | | | | | | | | midend_rewrite_statusbar() and check the result against the last string returned. This is now done centrally in drawing.c, and the front end status bar function need only do what it says on the tin. While I'm modifying the prototype of drawing_init(), I've also renamed it drawing_new() for the same reason as random_new() (it _allocates_ a drawing object, rather than just initialising one passed in). [originally from svn r6420]
* Patch from James H which initialises a couple of Windows API objectSimon Tatham2005-09-10
| | | | | | handles to NULL before accidentally trying to use them for anything. [originally from svn r6282]
* Take the Windows taskbar into account when deciding on the maximumSimon Tatham2005-09-06
| | | | | | | | | | | size of the puzzle window. This has involved some _completely stupid_ window manipulation: in order to figure out in advance how big I want my main window to be, I first have to _create_ the status bar so I know how tall it is; but since I can't reparent it into my main window after I've created it, I then have to throw that status bar away and create a new one. *sigh* [originally from svn r6276]
* Memory leak and type safety fixes from James H.Simon Tatham2005-08-25
| | | | [originally from svn r6219]
* Over-enthusiastic assertion introduced in the printing revamp wasSimon Tatham2005-08-24
| | | | | | causing Mines to crash one second after starting a game. Oops. [originally from svn r6214]
* Memory leak in the new printing stuff, plus a couple of commentSimon Tatham2005-08-22
| | | | | | corrections. [originally from svn r6199]
* Native Windows printing support, using the infrastructure I put inSimon Tatham2005-08-20
| | | | | | | | | | | | | | | | | | | | | place in r6190. I'm quite pleased that I didn't have to modify the printing infrastructure _at all_ to make this work; the only source change required outside windows.c was the addition of a trivial utility function midend_get_params(), and that was for the benefit of bulk puzzle generation rather than anything to do with actual printing. As far as I can tell, all printable puzzles now print almost indistinguishably from the way they print under Unix. If you look closely the font is slightly different, and the Windows standard hatching doesn't seem to be quite as nice as the kind I did by hand in ps.c (and, particularly annoyingly, hatched areas don't show up at all for me when I print to a file and use gv, though they come out fine on the printer itself); but it's all there, and it all works. [originally from svn r6193] [r6190 == af59dcf6858264103bbc621761feee3aed5aaf2a]
* Substantial infrastructure upheaval. I've separated the drawing APISimon Tatham2005-08-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | as seen by the back ends from the one implemented by the front end, and shoved a piece of middleware (drawing.c) in between to permit interchange of multiple kinds of the latter. I've also added a number of functions to the drawing API to permit printing as well as on-screen drawing, and retired print.py in favour of integrated printing done by means of that API. The immediate visible change is that print.py is dead, and each puzzle now does its own printing: where you would previously have typed `print.py solo 2x3', you now type `solo --print 2x3' and it should work in much the same way. Advantages of the new mechanism available right now: - Map is now printable, because the new print function can make use of the output from the existing game ID decoder rather than me having to replicate all those fiddly algorithms in Python. - the new print functions can cope with non-initial game states, which means each puzzle supporting --print also supports --with-solutions. - there's also a --scale option permitting users to adjust the size of the printed puzzles. Advantages which will be available at some point: - the new API should permit me to implement native printing mechanisms on Windows and OS X. [originally from svn r6190]
* Cleanups from James H: a few missing statics, a precautionary castSimon Tatham2005-08-03
| | | | | | | | | or two, a debugging fix, a couple of explicit initialisations of variables that were previously read uninitialised, and a fix for a whopping great big memory leak in Slant owing to me having completely forgotten to write free_game(). [originally from svn r6159]
* Quite a few instances of the Cardinal Error of Ctype were turned upSimon Tatham2005-07-17
| | | | | | by a grep I just did. Oops. [originally from svn r6113]
* draw_polygon() and draw_circle() have always had a portabilitySimon Tatham2005-07-03
| | | | | | | | | | | | | | | | | | | constraint: because some front ends interpret `draw filled shape' to mean `including its boundary' while others interpret it to mean `not including its boundary' (and X seems to vacillate between the two opinions as it moves around the shape!), you MUST NOT draw a filled shape only. You can fill in one colour and outline in another, you can fill or outline in the same colour, or you can just outline, but just filling is a no-no. This leads to a _lot_ of double calls to these functions, so I've changed the interface. draw_circle() and draw_polygon() now each take two colour arguments, a fill colour (which can be -1 for none) and an outline colour (which must be valid). This should simplify code in the game back ends, while also reducing the possibility for coding error. [originally from svn r6047]
* Load and Save are now supported on all three desktop platforms, andSimon Tatham2005-06-30
| | | | | | | documented. (This means the GTK temporary dependency on an environment variable is now gone.) [originally from svn r6042]
* The AngleArc() function that was being used to draw circles on Windows turnsJacob Nevins2005-06-25
| | | | | | | out to be unsupported on the Win9x/Me series. Use Arc() instead (tested on Win98 and Win2K). [originally from svn r6012]
* Change the preprocessor symbol `DEBUG' to `DEBUGGING', since theSimon Tatham2005-06-24
| | | | | | former is automatically defined by Cygwin. [originally from svn r6007]
* Introduce a front-end function to draw circles.Simon Tatham2005-06-23
| | | | [originally from svn r5991]
* This TODO comment should have been taken out in r5913 :-)Simon Tatham2005-06-22
| | | | | [originally from svn r5988] [r5913 == 02035753f817173a6861d1fc4bec437508cec42d]
* New front end functions to save and restore a region of the puzzleSimon Tatham2005-06-22
| | | | | | | | bitmap. Can be used to implement sprite-like animations: for example, useful for games that wish to implement a user interface which involves dragging an object around the playing area. [originally from svn r5987]
* Just noticed yesterday that initial window sizing is broken onSimon Tatham2005-06-18
| | | | | | | | | | | Windows for puzzles with status bars, because the initial call to check_window_size is given the window size _without_ the status bar and assumes that that has to be big enough for the whole thing _with_ the status bar, so it shrinks everything by a little bit. So now we resize the window to take account of the status bar before calling check_window_size(), and the problem seems to have gone away. [originally from svn r5975]
* All the games in this collection have always defined their graphicsSimon Tatham2005-06-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | in terms of a constant TILE_SIZE (or equivalent). Here's a surprisingly small patch which switches this constant into a run-time variable. The only observable behaviour change should be on Windows, which physically does not permit the creation of windows larger than the screen; if you try to create a puzzle (Net makes this plausible) large enough to encounter this restriction, the Windows front end should automatically re-adjust the puzzle's tile size so that it does fit within the available space. On GTK, I haven't done this, on the grounds that X _does_ permit windows larger than the screen, and many X window managers already provide the means to navigate around such a window. Gareth said he'd rather navigate around a huge Net window than have it shrunk to fit on one screen. I'm uncertain that this makes sense for all puzzles - Pattern in particular strikes me as something that might be better off shrunk to fit - so I may have to change policy later or make it configurable. On OS X, I also haven't done automatic shrinkage to fit on one screen, largely because I didn't have the courage to address the question of multiple monitors and what that means for the entire concept :-) [originally from svn r5913]
* Colin Watson suggests that Alt-click (or Option-click) couldSimon Tatham2005-06-03
| | | | | | | | | | | | usefully be equivalent to right-clicking on platforms other than OS X; in particular, it's useful if you're running Linux on Apple hardware such as PowerBook which inherently has only one button. So here's the fix for GTK, and Windows as well (the latter for completeness and consistency, not because I can actually think of any reason somebody might be running Windows on one-button hardware). [originally from svn r5907]
* Miscellaneous fixes from James Harvey's PalmOS porting work:Simon Tatham2005-06-01
| | | | | | | | | | | | | | | | | | | | - fixed numerous memory leaks (not Palm-specific) - corrected a couple of 32-bit-int assumptions (vital for Palm but generally a good thing anyway) - lifted a few function pointer types into explicit typedefs (neutral for me but convenient for the source-munging Perl scripts he uses to deal with Palm code segment rules) - lifted a few function-level static arrays into global static arrays (neutral for me but apparently works round a Palm tools bug) - a couple more presets in Rectangles (so that Palm, or any other slow platform which can't handle the larger sizes easily, can still have some variety available) - in Solo, arranged a means of sharing scratch space between calls to nsolve to prevent a lot of redundant malloc/frees (gives a 10% speed increase even on existing platforms) [originally from svn r5897]
* First cut at a game timer. Yet another backend function whichSimon Tatham2005-05-30
| | | | | | | | | | | | | | | indicates whether a particular game state should have the timer going (for Mines the initial indeterminate state does not have this property, and neither does a dead or won state); a midend function that optionally (on request from the game) prepends a timer to the front of the status bar text; some complicated midend timing code. It's not great. It's ugly; it's probably slightly inaccurate; it's got no provision for anyone but the game author decreeing whether a game is timed or not. But Mines can't be taken seriously without a timer, so it's a start. [originally from svn r5866]
* Add origin-shifting (Shift+cursors) and source-shifting (Ctrl+cursors) to Net.Jacob Nevins2005-05-26
| | | | | | | | | | | | (Adding modifier+cursors handling has had minor knock-on effects on the other puzzles, so that they can continue to ignore modifiers.) (An unfortunate side effect of this is some artifacts in exterior barrier drawing; notably, a disconnected corner can now appear at the corner of the grid under some circumstances. I haven't found a satisfactory way round this yet.) [originally from svn r5844]
* Move IDM_ABOUT so that it doesn't overlap the presets space! Ahem.Simon Tatham2005-05-20
| | | | [originally from svn r5814]
* After much thought, I've decided that `Restart' on r is not aSimon Tatham2005-05-17
| | | | | | | | particularly useful keypress, particularly given how easy it is to confuse it with `Redo'. So both r and ^R are now Redo, and Restart is relegated to being a menu-only option. [originally from svn r5796]
* The game IDs for Net (and Netslide) have always been random seedsSimon Tatham2005-05-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rather than literal grid descriptions, which has always faintly annoyed me because it makes it impossible to type in a grid from another source. However, Gareth pointed out that short random-seed game descriptions are useful, because you can read one out to someone else without having to master the technology of cross- machine cut and paste, or you can have two people enter the same random seed simultaneously in order to race against each other to complete the same puzzle. So both types of game ID seem to have their uses. Therefore, here's a reorganisation of the whole game ID concept. There are now two types of game ID: one has a parameter string then a hash then a piece of arbitrary random seed text, and the other has a parameter string then a colon then a literal game description. For most games, the latter is identical to the game IDs that were previously valid; for Net and Netslide, old game IDs must be translated into new ones by turning the colon into a hash, and there's a new descriptive game ID format. Random seed IDs are not guaranteed to be portable between software versions (this is a major reason why I added version reporting yesterday). Descriptive game IDs have a longer lifespan. As an added bonus, I've removed the sections of documentation dealing with game parameter encodings not shown in the game ID (Rectangles expansion factor, Solo symmetry and difficulty settings etc), because _all_ parameters must be specified in a random seed ID and therefore users can easily find out the appropriate parameter string for any settings they have configured. [originally from svn r5788]
* Introduce a versioning mechanism, and an `About' box in all frontSimon Tatham2005-05-15
| | | | | | | | | ends. Versioning will be done solely by Subversion revision number, since development on these puzzles is very incremental and gradual and there don't tend to be obvious points to place numbered releases. [originally from svn r5781]
* I've had two complaints that Solo ought to recognise the numericSimon Tatham2005-05-12
| | | | | | | | | | | | | | | | keypad. The reason it doesn't is because front ends were carefully translating the numeric keypad into 8-way directional keys for the benefit of Cube. Therefore, a policy change: - front ends process the numeric keypad by sending MOD_NUM_KEYPAD | '3' and similar - front ends running on a platform with Num Lock SHOULD do this _irrespective_ of the state of Num Lock - back ends do whatever they see fit with numeric keypad keys. Result: the numeric keypad now works in Solo, and also works in OS X Cube (which it previously didn't because I forgot to implement that bit of the front end!). [originally from svn r5774]
* Fix line endings when pasting on Windows.Simon Tatham2005-05-02
| | | | [originally from svn r5736]
* Added an automatic `Solve' feature to most games. This is useful forSimon Tatham2005-05-02
| | | | | | | | | | | | | | | | various things: - if you haven't fully understood what a game is about, it gives you an immediate example of a puzzle plus its solution so you can understand it - in some games it's useful to compare your solution with the real one and see where you made a mistake - in the rearrangement games (Fifteen, Sixteen, Twiddle) it's handy to be able to get your hands on a pristine grid quickly so you can practise or experiment with manoeuvres on it - it provides a good way of debugging the games if you think you've encountered an unsolvable grid! [originally from svn r5731]
* Oops; forgot to check in the copy-to-clipboard option for Windows.Simon Tatham2005-05-02
| | | | [originally from svn r5730]
* Remove outdated comment :-)Simon Tatham2005-05-01
| | | | [originally from svn r5722]
* I think Windows fonts look better in bold as well.Simon Tatham2005-05-01
| | | | [originally from svn r5721]
* Simplify clip region handling under Windows, which also makes Solo'sSimon Tatham2005-04-23
| | | | | | | | | | | | | | | | clipping policy work properly. I haven't proved why it didn't work the previous way, but I have a good guess: I think that clip regions are handled by reference. So I saved the old clip region out of the DC, then did an IntersectClipRect, and then selected the old clip region back in again - but the old clip region had never been _de_-selected, because IntersectClipRect didn't change which object was selected but rather it modified-in-place the one that already was selected. So my attempt to restore the old clip region did nothing whatsoever, and thus clipping to two different rectangles during the same draw sequence failed. Now I'm completely destroying the clip region during unclip(), which seems to work better. [originally from svn r5662]
* Oops. Just noticed that the Windows front end completely ignores theSimon Tatham2005-03-15
| | | | | | `colour' parameter in draw_text(). [originally from svn r5507]
* Rather than each game backend file exporting a whole load ofSimon Tatham2005-01-17
| | | | | | | | | | functions and a couple of variables, now each one exports a single structure containing a load of function pointers and said variables. This should make it easy to support platforms on which it's sensible to compile all the puzzles into a single monolithic application. The two existing platforms are still one-binary-per-game. [originally from svn r5126]
* Add a `jumble' key (`J') to Net, which scrambles the positions of all unlockedJacob Nevins2004-12-22
| | | | | | | | | | tiles randomly. (Rachel asked for this; it's been being tested for a good few months now, and Simon didn't care either way, so in it goes :) As part of this, the front end can now be asked to provide a random random seed (IYSWIM). [originally from svn r5019]
* Add grotty casts to prevent negative -> large positive conversion of cursorJacob Nevins2004-12-17
| | | | | | | position in Windows frontend; this showed up as a UI glitch while dragging to the left/top of the window in Rectangles. [originally from svn r5007]
* Added a help file, mostly thanks to Jacob.Simon Tatham2004-08-16
| | | | [originally from svn r4460]
* Now that we have string-encodable game parameters, let's support aSimon Tatham2004-05-20
| | | | | | | command-line argument which is either a set of parameters or a params+seed game ID. [originally from svn r4234]
* Framework alteration: we now support a `game_ui' structure inSimon Tatham2004-05-11
| | | | | | | | | | | | | addition to the `game_state'. The new structure is intended to contain ephemeral data pertaining to the game's user interface rather than the actual game: things stored in the UI structure are not restored in an Undo, for example. make_move() is passed the UI to modify as it wishes; it is now allowed to return the _same_ game_state it was passed, to indicate that although no move has been made there has been a UI operation requiring a redraw. [originally from svn r4207]
* Forgot to initialise the font variables in the Windows frontend structure.Simon Tatham2004-05-04
| | | | [originally from svn r4200]
* Forgot to set up the initial value of checkboxes.Simon Tatham2004-05-04
| | | | [originally from svn r4199]
* GTK and Windows appear to handle timers very differently:Simon Tatham2004-05-03
| | | | | | | | | | | specifically, the elapsed time between calls varies much more with GTK than it does under Windows. Therefore, I now take my own time readings on every timer call, and this appears to have made the animations run at closer to the same speed between platforms. Having done that, I decided some of them were at the _wrong_ speed, and fiddled with each game's timings as well. [originally from svn r4189]
* The Windows RNG turns out to only give about 16 bits at a time. ThisSimon Tatham2004-05-03
| | | | | | | | | | | | | | | is (a) pretty feeble, and (b) means that although Net seeds transfer between platforms and still generate the same game, there's a suspicious discrepancy in the typical seed _generated_ by each platform. I have a better RNG kicking around in this code base already, so I'll just use it. Each midend has its own random_state, which it passes to new_game_seed() as required. A handy consequence of this is that initial seed data is now passed to midend_new(), which means that new platform implementors are unlikely to forget to seed the RNG because failure to do so causes a compile error! [originally from svn r4187]
* Implement selection of game seeds, by reusing the config boxSimon Tatham2004-05-03
| | | | | | | | | mechanism I've just invented (the midend handles the standard game selection configuration). Each game is now required to validate its own seed data before attempting to base a game on it and potentially confusing itself. [originally from svn r4186]
* Game configuration box for Windows, by constructing the dialog boxSimon Tatham2004-05-03
| | | | | | | | | | right from scratch without the slightest reference to any dialog templates (meaning that we get to figure out the layout and _then_ choose the window size). I'm rather pleased with that. Also introduced free_cfg(), which is why this checkin touched gtk.c as well. [originally from svn r4184]
* Added a status bar.Simon Tatham2004-04-29
| | | | [originally from svn r4174]
* Implemented text and clipping primitives in the frontend, and addedSimon Tatham2004-04-29
| | | | | | two new simple games `fifteen' and `sixteen'. [originally from svn r4173]