本文整理汇总了Python中transform.Transform.inv_transform_coord方法的典型用法代码示例。如果您正苦于以下问题:Python Transform.inv_transform_coord方法的具体用法?Python Transform.inv_transform_coord怎么用?Python Transform.inv_transform_coord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类transform.Transform
的用法示例。
在下文中一共展示了Transform.inv_transform_coord方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ClientCommander
# 需要导入模块: from transform import Transform [as 别名]
# 或者: from transform.Transform import inv_transform_coord [as 别名]
class ClientCommander(Character):
def __init__(self, screen, server_commander):
super(Character, self).__init__()
self.screen = screen
self.t = Transform(screen, (0, 100, 0, 100))
self.server_commander = server_commander
def key_control(self, key, event):
Character.key_control(self, key, event)
# Custom comamnder control
def mouse_control(self, mouse_pos):
pass
def click_control(self, mouse_pos, button):
removed = False
wp = self.t.inv_transform_coord(mouse_pos)
for waypoint in self.server_commander.waypoints:
if dist(waypoint[0], waypoint[1], wp[0], wp[1]) < 0.25:
self.server_commander.rmwp(waypoint[0], waypoint[1])
removed = True
break
if not removed:
self.server_commander.addwp(wp[0], wp[1])
def update(self, game_map):
pass
def draw(self, game_map):
self.t.update_viewport((0, game_map.rows, 0, game_map.cols))
draw_bg(self.screen, self.t)
draw_walls(self.screen, self.t, game_map)
draw_hero(self.screen, self.t, game_map)
draw_units(self.screen, self.t, game_map)
draw_bullets(self.screen, self.t, game_map)
draw_waypoints(self.screen, self.t, game_map)
draw_letterbox(self.screen, self.t)