[Kde-games-devel] enums for unified CardCache
Andreas Pakulat
apaku at gmx.de
Tue Feb 5 18:29:34 CET 2008
On 05.02.08 12:30:20, Mauricio Piacentini wrote:
> Andreas Pakulat wrote:
> > Another option would be to allow a QString parameter to identify the
> > card, this means the most flexibility, but also the most fragility in
> > the CardCache code. There's no real type checking possible with this and
> > things will get badly broken when the user selects an svg deck that
> > doesn't contain the elements given to the cache.
>
> Maybe I did not understand all variables exactly, but in the cache
> classes I wrote for libkmahjongg I use a formatted QString as the key,
> as it is imo the most flexible approach. IIRC in libkmahjongg it has the
> format:
Uhm, this actually wasn't about the key used in the cache itself, but
about the API for CardCache. The class has a frontside() method which
returns a QPixmap of a card, the question is what paramter(s) to give to
frontside (or rather what type to use for the parameter(s)) to identify
which exact card should be rendered.
Currently this is a QFlags thingie, i.e. an enum with values 2, 4, 8,
... However this is limiting us to 32 elements, and 18 are already
taken by a 52 card deck.
So the question is wether to use multiple parameters for suite type and
card type or just a plain QString (which would need to be the same as
the element id inside the svg's).
Andreas
--
Look afar and see the end from the beginning.
More information about the kde-games-devel
mailing list