Example #1
0
 def drawObjectInPolygon( self, resourceType, polygon, rotation ):
     matrix = cairo.Matrix()
     matrix.scale( MapView.__pixelPerUnit, MapView.__pixelPerUnit )
     x, y = polygon.center
     width, height = GameItemTypes.getObjectSize( resourceType )
     matrix.translate( width, height )
     matrix.rotate( -rotation * math.pi / 4 )
     matrix.translate( -x, -y )
     pattern = PatternRepository.getPattern( "buildings", resourceType )
     pattern.set_matrix( matrix )
     self.ctx.set_source( pattern )
     self.ctx.paint()
Example #2
0
 def balanceableCell( self, balanceable, x = None, y = None, width = 1, height = 1 ):
     if x is not None: self.x = x
     if y is not None: self.y = y
     self.addCell( CairoTable.PatternCell( PatternRepository.getPattern( "balanceables", balanceable ) ), self.x, self.y, width, height )
     self.x += width