Thursday, January 22, 2009

KlonDuke 0.1

Here's my new useless software: KlonDuke
It's a graphical application based on the FLTK2 toolkit that lets you edit savefiles of the iPod game "Klondike".

(You must have already saved a game to use this tool)
It's really simple, just open it, click on "Open", select the "datafile" in the directory IPODDIR/iPod_Control/gamedata_RW/110xx (Where IPODDIR is the directory where the disk is mounted on unix-like systems or something like F: in Windows, and 110xx is the game ID starting by 110 with the last two digits changing from version to version), edit whatever you want (if it shows a wrong player name it's better that you simply close the program), click "save" and then "close" or "quit".

If something goes wrong you can delete the datafile from klondike's directory and the game will create a new one.

Screenshot:


Sources: klonduke-0.1.tar.gz
SHA1 Checksum: 334d212c228e354a9643693f1ecd51b7c028763a
Linux binary: klonduke-0.1_linux.tar.gz
SHA1 Checksum: 5441f93807876dda33dfb8b454a86717647fdd8b
Windows binary: I'm having problem with FLTK2 and MinGW
Mac binary: I don't have a Mac!

P.S.:
If you want to make a precompiled executable that isn't listed there simply leave a comment. I need a Mac binary and a MS VC++ one (VC is better than MINGW).

Wednesday, January 21, 2009

FLTK2 howto: Display images on widgets

I spent some time figuring out how to do this. Yes, you simply call:

widgetName->image(myPrettyImage);

But (at least for me) this did not work.
So I searched in the documentation but all seemed right.
The next logical step was "search on Google" (everyone should know that "he is your friend").

I read something on a forum regarding the function fltk::register_images() (Absolutely not documented) and I understood that it must be called before you use any other image-related stuff with fltk2.

So, if you want a widget to display your beautiful image you must code a main() like this:


#include "myMainWindowWithBackgrounImage.h"
#include <fltk/SharedImage.h>
#include <fltk/run.h>

int main()
{
fltk::register_images();
myMainWindowWithBackgroundImage win;
win.show();
return fltk::run();
}
You must then link the executable to libpng, libjpeg and libfltk2_images passing "-lpng -ljpeg -lfltk2_images" to the compiler.