Exemple #1
0
def movementMenu(element, target):
    def closer(icon):
        icon.frame.removeElement(icon)
        icon.unload()

    def func(menu):
        import lib.blacksmith as b
        menu.close()

        camera = menu.element.camera
        body = camera.area.getBody(target.avatar)
        endpoint = camera.surfaceToWorld(menu.anchor)
        path = camera.area.pathfind(body.bbox.bottomcenter, endpoint)

        #s = area.MovementSentinal(body, path)
        #camera.area.add(s)

        image = Image("path.png")

        for node in path:
            y, x = node
            icon = GraphicIcon(element.frame, image, closer)
            icon.load()
            icon.rect = pygame.Rect(x * 16, y * 16, 16, 16)
            menu.frame.addElement(icon)

    image = ImageTile("spellicons.png", tile=(20, 3), tilesize=(32, 32))

    m = RoundMenu(element.frame, element)
    a = GraphicIcon(element.frame, image, func, [m])
    m.setIcons([a])
    return m
Exemple #2
0
def movementMenu(element, target):
    def closer(icon):
        icon.frame.removeElement(icon)
        icon.unload()

    def func(menu):
        import lib.blacksmith as b
        menu.close()

        camera = menu.element.camera
        body = camera.area.getBody(target.avatar)
        endpoint = camera.surfaceToWorld(menu.anchor)
        path = camera.area.pathfind(body.bbox.bottomcenter, endpoint)

        #s = area.MovementSentinal(body, path)
        #camera.area.add(s)

        image = Image("path.png")

        for node in path:
            y, x = node
            icon = GraphicIcon(element.frame, image, closer)
            icon.load()
            icon.rect = pygame.Rect(x*16, y*16, 16, 16)
            menu.frame.addElement(icon) 

    image = ImageTile("spellicons.png", tile=(20,3), tilesize=(32,32))

    m = RoundMenu(element.frame, element)
    a = GraphicIcon(element.frame, image, func, [m])
    m.setIcons([a])
    return m
Exemple #3
0
def buildActionMenu(element):
    actions = element.avatar.queryActions(None)
    if actions:
        icons = [GraphicIcon(element.frame, a.icon, None) for a in actions]
        menu = RoundMenu(element.frame, element)
        menu.setIcons(icons)
        return menu
    else:
        return None
Exemple #4
0
def buildActionMenu(element):
    actions = element.avatar.queryActions(None)
    if actions:
        icons = [ GraphicIcon(element.frame, a.icon, None) for a in actions ]
        menu = RoundMenu(element.frame, element)
        menu.setIcons(icons)
        return menu
    else:
        return None
Exemple #5
0
def testMenu(element):
    def func(menu):
        import lib.blacksmith as b
        menu.close()

        anvil = b.Anvil()
        anvil.loadAll()
        pos = menu.element.camera.surfaceToWorld(menu.anchor) - (16, 16, 0)
        menu.element.camera.area.add(anvil)
        menu.element.camera.area.setPosition(anvil, pos)

    image = Image("grasp.png")

    m = RoundMenu(element.frame, element)
    a = GraphicIcon(element.frame, image, func, [m])
    b = GraphicIcon(element.frame, image, func, [m])
    c = GraphicIcon(element.frame, image, func, [m])
    d = GraphicIcon(element.frame, image, func, [m])
    m.setIcons([a, b, c, d])
    return m
Exemple #6
0
def testMenu(element):
    def func(menu):
        import lib.blacksmith as b
        menu.close()

        anvil = b.Anvil()
        anvil.loadAll()
        pos = menu.element.camera.surfaceToWorld(menu.anchor) - (16, 16, 0)
        menu.element.camera.area.add(anvil)
        menu.element.camera.area.setPosition(anvil, pos)

    image = Image("grasp.png")

    m = RoundMenu(element.frame, element)
    a = GraphicIcon(element.frame, image, func, [m])
    b = GraphicIcon(element.frame, image, func, [m])
    c = GraphicIcon(element.frame, image, func, [m])
    d = GraphicIcon(element.frame, image, func, [m])
    m.setIcons([a,b,c,d])
    return m