Esempio n. 1
0
 def select( self, screen, polygons ):
     for polygon in polygons:
         all_points = polygon.get_points()
         highlights = []
         for i in range( 0, len( all_points ) ):
             p = all_points[ i ]
             z = p.z - self.position.z
             if polygon.is_selected() and z < self.observer.z and p.z == self.position.z:
                 this = Point( p.x - self.position.x, p.y - self.position.y, z )
                 prev = all_points[ i - 1 ]
                 last = Point( prev.x - self.position.x, prev.y - self.position.y, z )
                 highlights.append( [ last.rel_to( self.observer ), this.rel_to( self.observer ) ] )
         for highlight in highlights:
             pygame.draw.line( screen, ( 255, 0, 0 ), highlight[ 0 ], highlight[ 1 ], 1 )
Esempio n. 2
0
 def highlight( self, screen, polygons ):
     for polygon in polygons:
         all_points = polygon.get_points()
         highlights = []
         for i in range( 0, len( all_points ) ):
             p = all_points[ i ]
             z = p.z - self.position.z
             if z < self.observer.z and p.z == self.position.z:
                 this = Point( p.x - self.position.x, p.y - self.position.y, z )
                 highlights.append( [ this.rel_to( self.observer ) ] )
                 prev = all_points[ i - 1 ]
                 if prev.z == self.position.z:
                     last = Point( prev.x - self.position.x, prev.y - self.position.y, z )
                     highlights.append( [ last.rel_to( self.observer ), this.rel_to( self.observer ) ] )
         for highlight in highlights:
             if len( highlight ) == 1:
                 pygame.draw.circle( screen, self.highlight_colour, highlight[ 0 ], self.highlight_radius, 1 )
             elif len( highlight ) == 2:
                 pygame.draw.line( screen, self.highlight_colour, highlight[ 0 ], highlight[ 1 ], 1 )