Example #1
0
 def __init__(self, *args, **kwargs):
     views = [
         LabelView(
             LOGO[1:].rstrip(),
             layout_options=LayoutOptions.row_top(0.5)),
         LabelView(
             "Try resizing the window!",
             layout_options=LayoutOptions.centered('intrinsic', 'intrinsic')),
         ButtonView(
             text="Play", callback=self.play,
             color_bg='#000000', color_fg='#00ff00',
             layout_options=LayoutOptions.row_bottom(4).with_updates(
                 left=0.2, width=0.2, right=None)),
         ButtonView(
             text="Settings", callback=self.show_settings,
             layout_options=LayoutOptions.row_bottom(4).with_updates(
                 left=0.4, width=0.2, right=None)),
         ButtonView(
             text="[color=red]Quit",
             callback=lambda: self.director.pop_scene(),
             # [color=red] messes up auto size calculations
             size=Size(4, 1),
             layout_options=LayoutOptions.row_bottom(4).with_updates(
                 left=0.6, width=0.2, right=None)),
     ]
     super().__init__(views, *args, **kwargs)
Example #2
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.info_bar_view = LabelView(' Status/Resources',
                                    align_horz='left',
                                    layout_options=LayoutOptions.row_top(1))
     self.world_view = View(layout_options=LayoutOptions(top=2))
     self.message_view = RectView(
         layout_options=LayoutOptions.row_bottom(10))
     self.add_subviews(
         [self.info_bar_view, self.world_view, self.message_view])
Example #3
0
 def __init__(self, game_state, *args, **kwargs):
     self.game_state = game_state
     self.progress_bar = ProgressBarView(
         fraction=1,
         layout_options=LayoutOptions.row_top(1).with_updates(top=3,
                                                              right=1))
     self.health_label = LabelView(
         text="  Health: ?  ",
         color_fg="#ffffff",
         color_bg='#000000',
         layout_options=LayoutOptions.row_top(1).with_updates(top=2,
                                                              right=1))
     self.inventory_count = LabelView(
         text="  Rocks: 0  ",
         color_fg="#ffffff",
         color_bg="#000000",
         layout_options=LayoutOptions.row_top(1).with_updates(top=4,
                                                              right=1))
     self.score_label = LabelView(
         text="Score: 0",
         color_fg="#ffff00",
         color_bg="#000000",
         layout_options=LayoutOptions.row_top(1).with_updates(top=6,
                                                              right=1))
     super().__init__(subviews=[
         LabelView(
             text="Stats",
             color_fg='#ffffff',
             color_bg='#660000',
             clear=True,
             layout_options=LayoutOptions.row_top(1).with_updates(right=1)),
         self.health_label,
         self.progress_bar,
         self.inventory_count,
         self.score_label,
     ],
                      *args,
                      **kwargs)
     self.update()
Example #4
0
 def __init__(self, *args, **kwargs):
     view = WindowView(
         'Pause',
         layout_options=LayoutOptions.centered(40, 10),
         subviews=[
             ButtonView(text='Resume',
                        callback=self.resume,
                        layout_options=LayoutOptions.row_top(5)),
             ButtonView(text='Quit',
                        callback=self.quit,
                        layout_options=LayoutOptions.row_bottom(5)),
         ])
     super().__init__(view, *args, **kwargs)
     self.covers_screen = False
Example #5
0
    def __init__(self, *args, **kwargs):
        view = WindowView(
            'Character',
            layout_options=LayoutOptions(top=7, right=10, bottom=7, left=10),
            subviews=[
                LabelView('There is no game yet.', layout_options=LayoutOptions.row_top(0.5)),
                ButtonView(
                    text='Darn', callback=lambda: self.director().pop_scene(),
                    layout_options=LayoutOptions.row_bottom(0.5)),
            ]
        )
        super().__init__(view, *args, **kwargs)

        self.covers_screen = False
Example #6
0
 def __init__(self, *args, **kwargs):
     views = [
         LabelView(
             FONT_LOGO.renderText('BeepBoop'),
             layout_options=LayoutOptions.row_top(0.3)),
         LabelView(
             get_image('robot'),
             layout_options=LayoutOptions(top=0.3, bottom=4)),
         ButtonView(
             text="Play", callback=self.play,
             layout_options=LayoutOptions.row_bottom(4).with_updates(left=0.2, width=0.2, right=None)),
         ButtonView(
             text="Settings", callback=self.show_settings,
             layout_options=LayoutOptions.row_bottom(4).with_updates(left=0.4, width=0.2, right=None)),
         ButtonView(
             text="Quit", callback=lambda: self.director().pop_scene(),
             layout_options=LayoutOptions.row_bottom(4).with_updates(left=0.6, width=0.2, right=None)),
     ]
     super().__init__(views, *args, **kwargs)
Example #7
0
 def __init__(self, *args, **kwargs):
     views = [
         LabelView(TITLE[1:].rstrip(),
                   layout_options=LayoutOptions.row_top(0.5)),
         LabelView(ABOUT,
                   color_fg='#ffcb00',
                   layout_options=LayoutOptions.centered(
                       'intrinsic', 'intrinsic').with_updates(top=28)),
         ButtonView(
             text="Descend the stairs",
             callback=self.play,
             layout_options=LayoutOptions.row_bottom(10).with_updates(
                 left=0.2, width=0.2, right=None)),
         ButtonView(
             text="Quit",
             callback=lambda: self.director.pop_scene(),
             layout_options=LayoutOptions.row_bottom(10).with_updates(
                 left=0.6, width=0.2, right=None)),
     ]
     super().__init__(views, *args, **kwargs)