Пример #1
0
class RaidneInterface(object):

    def __init__(self):
        self.init_display()

    def init_display(self):
        self.dungeon = Dungeon()
        self.dungeon.message('Welcome to raidne!')
        # FIXME this is a circular reference.  can urwid objects find their own containers?
        self.main_widget = MainWidget(self.dungeon)

    def run(self):
        self.loop = urwid.MainLoop(self.main_widget, pop_ups=True)

        # XXX what happens if the terminal doesn't actually support 256 colors?
        self.loop.screen.set_terminal_properties(colors=256)
        self.loop.screen.register_palette(PALETTE_ENTRIES)

        # Game loop
        self.loop.run()

        # End
        print("Bye!")
Пример #2
0
 def init_display(self):
     self.dungeon = Dungeon()
     self.dungeon.message('Welcome to raidne!')
     # FIXME this is a circular reference.  can urwid objects find their own containers?
     self.main_widget = MainWidget(self.dungeon)