[Kde-games-devel] Questions about basic game programming
Wolfgang Rohdewald
wolfgang at rohdewald.de
Thu Feb 19 16:59:07 CET 2009
On Donnerstag, 19. Februar 2009, Frederik Schwarzer wrote:
> Looking into the painting issue and evaluating if a port makes sense is my
> next big goal in KShisen. :)
I'v just done the transition from QLabels for the tiles to
QGV for kmj - this simplifies a lot, especially for kmj where I have
to attach tiles rotated by 90 degrees. Now Usage is quite easy.
I have a class Board where I can position tiles by specifiying the
position in tile units - independently of the real tile size, like in
self.walls = [self.wall(angle) for angle in (270, 0, 90, 180)]
self.walls[0].setPos(xWidth=self.length, yWidth=self.length, yHeight=1 )
self.walls[1].setPos(yWidth=self.length)
self.walls[2].setPos(xHeight=1)
self.walls[3].setPos(xHeight=1, xWidth=self.length, yHeight=1)
This little bit of code draws a Shisen board:
class Shisen(Board):
"""builds a Shisen board, just for testing"""
def __init__(self):
Board.__init__(self)
tile = self.randomTile144() # an iterator
for row in range(0, 8):
for col in range(0, 18):
self.addTile(tile.next(), xoffset=col, yoffset=row)
But I cannot see a noticeable difference in speed.
--
Wolfgang
More information about the kde-games-devel
mailing list