[Kde-games-devel] A new highscore manager - KScoreManager

Matt Williams matt at milliams.com
Wed Apr 30 17:46:07 CEST 2008


On Tuesday 29 April 2008 02:37:18 Matt Williams wrote:
> Some of you may have noticed that I've been fighting with KScoreDialog for
> the last day or two. Now between me, Albert and Fela we've managed to find
> a way to fix all the reported bugs in time for 4.1 so that people are no
> longer tearing their hair out. But as anyone who's taken a look at the
> source code will have realised, it's a bloody mess inside. Much of the guts
> of the class dates back to 1998 and after changing maintainers several
> times and even going without maintainers sometimes it's grown unruly.
>
> And so my plan is this: I'm going to fix up the bugs in KScoreDialog as
> best I can in time for 4.1, but for 4.2, I'm going to write a new highscore
> management system. I'm going to keep it in much the same spirit as
> KScoreDialog (i.e. a simple highscore management system, not designed to
> handle worldwide scores or anything) but I'm going to clean up the API and
> make the workflow much nicer. I'm also going to rewrite the background
> stuff to make it maintainable.
>
> Attached is the current API for the class (named KScoreManager). I haven't
> written any of the .cpp yet because I wanted to make sure the API made
> sense first. Yes, the file is about 80% comments but I'd appreciate it if
> people were to look through the API and code examples in the comments and
> tell me the places where I'm being stupid :). After a little bit of API
> review here I'll probably import it into playground until 4.1 gets branched
> off at which point I'll move it to trunk.
>
> Comments? Complaints? Insults?
>
> Regards,
> Matt Williams

Just an update...

I've committed the current version to SVN playground, it can be found at 
http://websvn.kde.org/trunk/playground/games/kscoremanager/. Hopefully by 
tomorrow the doxygen generator will have run and so documentation will be 
available at 
http://api.kde.org/playground-api/games-apidocs/kscoremanager/html/index.html. 
There's still no .cpp code, just headers.

The adding scores/grouping scores etc. hasn't changed much but now the UI is 
completely independent of the manager so you can do something like:

KScoreBoardDialog boardDialog();
boardDialog.show();
OR
KScoreBoardGraphicsWidget boardWidget();
m_scene->addItem( boardWidget );

calling boardDialog::show() will update the information in it to the latest 
provided by KScoreManager::self() so you can get away with with having 
KScoreBoardDialog as a member variable and safely just call show() whenever 
you want.

If addScore() has just been called and so a name entry is required then the 
BoardDialog will take this into account, provide a way for the player to 
enter their name and then submit this back to KScoreManager.

Fell free to take a look at the code and once the doxygen run is done it will 
make it much nicer to read the API :)

Regards,
Matt Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20080430/223b5cb8/attachment.pgp 


More information about the kde-games-devel mailing list