Showing posts with label sdl. Show all posts
Showing posts with label sdl. Show all posts

Saturday, 28 February 2009

Version 1.1

Ledow has released version 1.1 of STPPC2x!

The latest version of my efforts to port Simon Tatham's Portable Puzzle Collection to the GP2X. This is a set of 31 addictive logic and puzzle games. Some are old favourites (like sudoku, sliding puzzles and minesweeper) and others you may not have seen before.



You can download STPPC2x immediately from the main website or from the GP2X archive. The music pack is unchanged and can be downloaded from the main website too.

So, what's new?

Collection:

Display - Show whether a game supports numeric input, a solver, etc. on the main menu, removed a couple of incorrect screen updates that could make the menu flicker, game preview images now centre properly (e.g. Maze3D's).

Gameplay - All games now have cursor-mode control, status-bar messages now "time out" rather than linger forever.

Input - Digit input for large games that need characters rather than just numbers.

Memory - Can now take advantage of the upper 32Mb of RAM should we ever run out of memory on the GP2X.

Screenshots - Now disabled by default, enable and press Stick-Click to use them.

Size - The size of the executable has been reduced by a number of means: removal of unused code, better final compression, shortening of static buffers, etc. Also, the images have been compressed more using pngcrush. This should save up to 500Kb on the GP2X.

Games

Cube - Massive memory usage (spotted by me) now fixed (by Simon Tatham).
Dominosa - More presets.
Guess - Fixed potential crash.
Loopy - improve generation of "Great-Hexagonal" games, quicker solvers.
Map - "Show immutable regions" option now removed - you can just press Y and the regions that can't be changed highlight in red.
Mosco - Fix completion bug, add end-of-game flash, clicking on the edge tiles highlights squares that could "point" to them, non-square grids and new presets.
Solo - Show intermediate lines properly, enable 4x4 etc. presets, add "Killer" Sudoku mode.

Feedback is appreciated and full source code is available from:

http://www.ledow.org.uk/gp2x/ or http://code.google.com/p/stppc2x/

Tuesday, 11 November 2008

STPPC2x v1.1 News

Just to reassure everyone, I'm still working on STPPC2x after my "version 1.0" release.

At the moment, I have the following in progress for "version 1.1":

Menus - Added indicators on the main menu to tell whether a game requires numeric digit input (e.g. filling, solo, unequal), supports "cursor key" control (e.g. sokoban, maze3d, etc.) or has its own solver.

Mosco - Various memory cleanups, a working "end-of-game" detector with "flash" ( so that you know you've won) - I left a bug in the version released for v1.0 that lets you complete the game even if some of the conditions aren't met.

Solo (Sudoku) - Perfect display with all the intermediate lines but in a "normal" resolution now. 4x4 sudoku is also playable because I've adjusted the "digit" input code (e.g. Press L/R to increase digit and X to enter it into a square) so that you can use the letters too... 4x4 sudoku needs 1-9, A-G, for instance.

Unequal - Because of the above, you can now play much larger unequal games too, and smaller games now only let you select numbers that are "in range" (e.g. 1 - 4 on a 4x4 unequal, 0-9 on a 10x10 unequal, 0-G on a 16x16 unequal etc.)

Loopy - New SVN updates provide better puzzle generation when using "Great Hexagonal" layouts etc.

I'm also working on a Kakuro puzzle, because it's nice to have a new puzzle each time I put out a big update.

Friday, 18 April 2008

Unicode, font, SDL and graphics.

I have just added the feature to allow people to configure the games in STPPC2x. On the way, knowing that my graphical design skills are somewhere in the realm of a small five-year-old with a large crayon, I wanted a quick way to "pretty" up the interface without having to draw anything myself.

I needed a checkbox, which is quite an easy thing to draw anyway. I wanted one that I could tick, cross or leave blank and which wouldn't look like I'd drawn a square box around a poorly fitting line-based cross or tick.

In the end, I looked at what resources I already had included in the project (allowing code re-use, not to mention keeping necessary dependencies to a minimum) and I already had SDL_ttf and the DejaVu font. The font was a random choice because I just wanted a "free to distribute" font that was small and easy to read, but it turned out to work very well.

Hidden away in the depths of the Unicode specification, there are a multitude of symbols that hardly anyone ever uses or even sees. These, apparently, include things like several styles of cross/tick (including "ballot" styles, made to look like a hand-drawn cross/tick), chess figures, dominoes, dice, and all manner of symbols, logos and signs. The mathematical symbols were also out of this world, line-drawing characters, "disabled" symbols, you name it. There are even circled numbers and letters, which prevent having to "guess" how big a number is going to render, fudging the font size and then circling it manually.

As it turned out, the DejaVu fonts have remarkably good Unicode support (the only other real competitor that I have personally seen is Arial Unicode, but obviously there are distribution problems with that one) and included all of the symbols that I felt like using.

But someone could easily write a board game, or avoid spending hours recreating a symbol in a vector format, using the Unicode characters, precise sizing and the DejaVu font. And, obviously, being a font it scales well to all sizes, can be coloured etc to your heart's content and can be rendered inline with text without causing problems. And the DejaVu fonts only take up half-a-megabyte, if that, and contains thousands of pieces of "clipart".

So, with SDL and SDL_ttf, it was simply a matter of changing my conservative SDL_RenderTextSolid to SDL_RenderUTF8Solid and figure out how to include the characters in a C string (Gucharmap on Slackware Linux was a big help here because it gives you the C escape codes for the UTF8 versions of any character in a Unicode font). No more memory is used, no more code is needed if you already have font-rendering code in there, and only a tiny amount of disk space is used for the whole thing. It was a great find and it's improved the look of the menu I was writing immensely.