Ejemplo n.º 1
0
 def __drawInput( self, data ):
     ''' Draw user interaction. '''
     # Draw input vector.
     
     if data.mousePressed and data.state in [data.STATES.STARTING, data.STATES.PLAYING]:
         color = 'blue'
         x0 = screenconvert.worldToScreen( data.level.map.player.position.x, data.screenXCoefficient )
         y0 = screenconvert.worldToScreen( data.level.map.player.position.y, data.screenYCoefficient )
         x1 = screenconvert.worldToScreen( data.mousePosition.x, data.screenXCoefficient )
         y1 = screenconvert.worldToScreen( data.mousePosition.y, data.screenYCoefficient )
         self.canvas.create_line( x0, y0, x1, y1, arrow = 'last', fill = color, width = 2 )
Ejemplo n.º 2
0
 def worldToScreenY( self, y ):
     ''' Converts world y to screen y coordinate. '''
     return screenconvert.worldToScreen( y, self.screenYCoefficient )
Ejemplo n.º 3
0
 def worldToScreenX( self, x ):
     ''' Converts world x to screen x coordinate. '''
     return screenconvert.worldToScreen( x, self.screenXCoefficient )