[Kde-games-devel] A new highscore manager - KScoreManager
Matt Williams
matt at milliams.com
Tue Apr 29 21:19:51 CEST 2008
On Tuesday 29 April 2008 17:50:49 Parker Coates wrote:
> But after having thought about this further, maybe it makes sense to
> completely separate the "score manager" back-end from the "score
> display" front-ends into separate classes. Please bear with me: OO
> class design isn't a particular strength of mine, so if something
> below seems downright nonsensical or impossible, don't hesitate to
> shoot me down.
>
> KScoreManager::self()->addField(KScoreDialog::Custom1, i18n(Moves Taken));
> KScoreManager::self()->setDisplayFields(KScoreDialog::Name |
> KScoreDialog::Score | KScoreDialog::Custom1);
>
> KScoreManager::ScoreInfo scoreInfo;
> scoreInfo[KScoreDialog::Name] = playerName;
> scoreInfo[KScoreDialog::Score] = playerScore;
> scoreInfo[KScoreDialog::Custom1] = numberOfMovesTaken;
>
> if ( KScoreManager::self()->addScore(scoreInfo) )
> {
> KScoreDialog scoreDialog( KScoreManager::self() );
> scoreDialog.show();
>
> // OR
>
> KGraphicsScoreItem scoreItem( KScoreManager::self() );
> m_scene->addItem( scoreItem );
> }
OK, now that I've though about it a little bit I'd like some people's opinions
on how things should work. The way I was envisioning things working was when
the call to addScore() is made, a dialog of some kind would be provided for
the user to enter their name (unless this has been disabled). The name entry
dialog would tell the user what place their score came.. Then when show() (or
createDialog() or passing KScoreManager::self() to a KScoreBoard constructor
etc.) is called the scoreboard will be shown, but it would be static. That
is, the name would no longer be entered 'inline'.
Now, if we're going to be abstracting away the display of the highscore table
it would make sense to also allow any method of entering a name (i.e. a
KDialog or a entryfield in the QGraphicsScene).
Any ideas about how name entry would work, when the score board should be
show, who should handle the name entry, etc.? For example, in the snippet you
posted above, the call to addScore() is made before any UI frontend is
created and so the frontend won't be able to handle adding the name.
Any thoughts?
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/20080429/e785317a/attachment.pgp
More information about the kde-games-devel
mailing list