Ejemplo n.º 1
0
 def on_mouse_release(self, x, y, buttons, modifiers):
     player = current_player()
     source = self.map.selected_node(player)
     target = self.map.targeted_node(player)
     if source is not None and source is not target:
         player = current_player()
         self.map.move_units_to_target(player)
     self.map.select_node(player, None)
Ejemplo n.º 2
0
 def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
     player = current_player()
     if self.map.selected_node(player) is not None:
         px, py = self.map_view.map_from_pixel(*self.pixel_from_screen(x, y))
         n = self.map.closest_node_to(px, py)
         self.map.target_node(player, n)
Ejemplo n.º 3
0
 def on_mouse_press(self, x, y, buttons, modifiers):
     px, py = self.map_view.map_from_pixel(*self.pixel_from_screen(x, y))
     n = self.map.closest_node_to(px, py)
     player = current_player()
     if self.map.get_owner(n) is player:
         self.map.select_node(player, n)