[Kde-games-devel] Tiles in KShisen

Luciano Montanaro mikelima at cirulla.net
Mon Jan 19 22:42:15 CET 2009


On Monday 19 January 2009, Wolfgang Rohdewald wrote:
> On Montag, 19. Januar 2009, Mauricio Piacentini wrote:
> > So
> > maybe we need to add a property to the tileset .desktop that controls
> > this, and maybe prevent loading in a given client depending on matching
> > rules. We could then increase the tileset format version and patch
> > KMahjongg/KShisen to recognize this.
>
> in kmj I simply filter out the alphabet tileset.
>
> Actually none of the tilesets is perfect for kmj - the round wind tiles
> are missing and some of the shadows / borders are looking strange. kmj
> also needs to rotate tiles by 90/180/270 degrees which makes
> shadows/borders look even stranger. I need to use tiles with different
> angles and combine them (rotate some of them), but then adjacent
> borders/shadows can look very different from each other where they should
> be identical. I wonder where the light source is meant to be - there should
> be no such effects if the angle is always a multiple of 45 degrees.
>

So let's extend the tileset format. It should not need too many changes...
I think it already has the tile separated from the mah-jongg symbols, isn't 
it?

So maybe all it needs is:
- adding the missing symbols 
- add the rotated tile +shadow. (or rotate the existing tiles...)
- add a "back" tile

I think it should be possible to just rotate the existing tiles, although that 
may need finding the right orientation for each rotated tile...
  
Then you compose the final tiles as it is done at the moment but twice, one 
time for the vertical tiles, the second one for the horizontal tiles. 

> Also, in kmj I need to be able to draw reversed tiles (face down). I
> simulate that by drawing tiles without faces.
>

That one should simply be added. It should not be that difficult. It may just 
be another "symbol" to draw over the tile background.

> So all in all kmj probably has very different code for drawing tiles
> compared to libkmahjongg - I did not read thru all the C++ code.
>
>     def tilesAvailable():
>         """returns all available tile sets"""
>         Tileset.defineCatalog()
>         tilesAvailableQ = kdecore.KGlobal.dirs().findAllResources(
>             "kmahjonggtileset", "*.desktop",
> kdecore.KStandardDirs.Recursive) # now we have a list of full paths. Use
> the base name minus .desktop: tilesets =
> [str(x).rsplit('/')[-1].split('.')[0] for x in tilesAvailableQ ]
> tilesets.remove('alphabet')
>         return [Tileset(x) for x in tilesets]



-- 
Luciano Montanaro //
                \X/ mikelima at cirulla.net


More information about the kde-games-devel mailing list