Exemple #1
0
 def __init__(self):
     SubScreenWindow.__init__(self)
     self.icons = {
         'tnt': gui.Picture(img='gfx/ui/item_dynamite.png'),
         'strength': gui.Picture(img='gfx/ui/icon_strength.png'),
         'def': gui.Picture(img='gfx/ui/icon_pres.png'),
         'mag': gui.Picture(img='gfx/ui/icon_mag.png'),
     }
     self.font = system.engine.font
Exemple #2
0
    def __init__(self, saves, saving=False):
        super(SaveLoadMenu, self).__init__()

        self.icons = dict([
                (s, gui.Picture(image='gfx/ui/icon_%s.png' % s))
                for s in ('att', 'mag', 'pres', 'mres')
            ]
        )

        self.cursor = cursor.ImageCursor('gfx/ui/pointer.png')
        self.saves = saves
        boxes = [SaveGameFrame(save=s, icons=self.icons) for s in saves]

        if saving:
            boxes.append(TextFrame(text='Create New'))
        elif not boxes:
            boxes.append(TextFrame(text='No Saves'))

        self.layout = layout.VerticalBoxLayout(pad=16)
        self.layout.setChildren(boxes)
        self.layout.layout()
        self.cursorPos = 0
        self.oldY = 0  # current offset
        self.curY = 0  # offset we should be at

        if boxes:
            self.wndHeight = boxes[0].height + 16
        else:
            self.wndHeight = 0  # What should we do here?

        self.layout.x = 16  # doesn't change
Exemple #3
0
    def __init__(self, saves, saving = False):
        self.icons = dict(
            [(s, gui.Picture(img='gfx/ui/icon_%s.png' % s))
                for s in ('att', 'mag', 'pres', 'tnt')]
        )

        self.cursor = ImageCursor('gfx/ui/pointer.png')

        self.saves = saves
        self.saving = saving

        boxes = [SaveGameFrame(save=s, icons=self.icons) for s in saves]
        if saving:
            boxes.append(gui.TextFrame(text='Create New'))
        elif not boxes:
            b = gui.TextFrame(text='No Saves')
            
            boxes.append(b)

        self.layout = layout.VerticalBoxLayout(pad=16, *boxes)
        self.layout.layout()

        self.cursorPos = 0
        self.oldY = 0 # current offset
        self.curY = 0 # offset we should be at
        self.offset=-14
        
        if boxes:
            self.wndHeight = self.layout.children[0].Height + 16
        else:
            self.wndHeight = 0 # What should we do here?

        self.layout.X = 100 # doesn't change
Exemple #4
0
    def createContents(self):

        contents = []
        
        for img in self.icons:
            contents.append(gui.Picture(image=img, width=self.iconWidth, height=self.iconHeight))

        while len(contents) < 8:
            contents.append(layout.Spacer())
        
        return contents
Exemple #5
0
def text(text, **kw):
    # gather arguments
    draw = kw.get('draw', ika.Map.Render)
    portrait = kw.get('portrait', None)
    caption = kw.get('caption', None)

    # create the text frame
    textbox = createTextBox(text, **kw)
    textbox.dockLeft().dockBottom()  # set the position

    # handle the portrait (if any)
    if portrait is not None:
        if isinstance(portrait, (str, ika.Canvas, ika.Image)):
            portrait = gui.Picture(image=portrait)
        elif portrait is not None and not isinstance(portrait, gui.Picture):
            assert False, 'portrait argument must be a string, Canvas, Image, Picture, or None'
        portrait.dockLeft().dockBottom(textbox)

    if caption is not None:
        caption = gui.FrameDecorator(gui.StaticText(text=caption))
        caption.autoSize()
        caption.dockRight().dockBottom(textbox)

    # Do the swoosh-in
    trans = Transition()
    trans.addChild(textbox, startRect=(textbox.x, ika.Video.yres))
    if portrait is not None:
        trans.addChild(portrait, startRect=(-portrait.width, portrait.y))
    if caption is not None:
        trans.addChild(caption, startRect=(ika.Video.xres, caption.y))
    trans.execute(draw)

    # unpress
    controls.enter()
    controls.joy_enter()
    controls.ui_accept()

    # Let the player read
    while not (controls.enter() or controls.joy_enter()
               or controls.ui_accept()):
        draw()
        trans.draw()

        ika.Video.ShowPage()
        ika.Input.Update()

    # swoosh-out
    trans.addChild(textbox, endRect=(textbox.x, ika.Video.yres))
    if portrait is not None:
        trans.addChild(portrait, endRect=(portrait.x, ika.Video.yres))
    if caption is not None:
        trans.addChild(caption, endRect=(ika.Video.xres, caption.y))
    trans.execute(draw)
Exemple #6
0
    def refresh(self, char):
        self.client.removeAllChildren()
        portrait = gui.Picture(image=char.portrait)

        text = gui.StaticText(text=[
            char.name,
            'Lv %i' % char.level,
            'HP\t%i/%i' % (char.hp, char.maxHP),
            'MP\t%i/%i' % (char.mp, char.maxMP),
        ])

        t2 = gui.StaticText(text=[
            'Exp\t%i' % char.stats.exp,
            'Next\t%i' % (char.expneeded - char.stats.exp)
        ])

        portrait.position = (0, 0)
        text.position = (portrait.right, 0)
        t2.position = (0, portrait.bottom + 2)

        self.client.addChildren(portrait, text, t2)
        text.autoSize()
        t2.autoSize()
        self.autoSize()
Exemple #7
0
 def createContents(self):
     self.text = gui.StaticText(text=` self.amount `)
     return [gui.Picture(image="gfx/items/icon_seashell.png"), self.text]
Exemple #8
0
 def __init__(self):
     SubScreenWindow.__init__(self)
     self.icons = dict([(s, gui.Picture(img='gfx/ui/icon_%s.png' % s))
                        for s in ('att', 'mag', 'pres', 'mres', 'tnt')])