Example #1
0
def dummy_main_menu():
    libtcod.console_set_default_foreground(0, libtcod.light_yellow)
    libtcod.console_print_ex(0,
            settings.SCREEN_W/2, settings.SCREEN_H/2-12,
            libtcod.BKGND_NONE, libtcod.CENTER,
            'BARBARIAN QUEST III')
    libtcod.console_print_ex(0,
            settings.SCREEN_W/2, settings.SCREEN_H/2-8,
            libtcod.BKGND_NONE, libtcod.CENTER,
            'Zangdoz\'s Revenge')
    libtcod.console_print_ex(0,
            settings.SCREEN_W/2, settings.SCREEN_H-2,
            libtcod.BKGND_NONE, libtcod.CENTER,
            'By Zobinet')
Example #2
0
def dummy_draw_console(con, x, y, blit_on=0):
    """
    Blits the widget to the console passed as parameter (defaults to
    the root console), with its top-left corner at the specified
    x:y position.
    This is the bare minimum any widget will have to do to draw
    itself.
    """
    # if self.framed:
    #     # draw an old school looking frame around the window \o/
    #     libtcod.console_set_foreground_color(con, self.frame_color)
    #     libtcod.console_print_frame(self.con, 0, 0, self.w, self.h,
    #                                 False, libtcod.BKGND_NONE, self.title)
    # blit any children on the widget's console
    # for child in con.children:
    #     child.display()
    # Blit self
    # !TEMPO!
    if id(con) not in tcod_consoles:
        new_console = libtcod.console_new(con.w, con.h)
        # libtcod.console_set_default_foreground(new_console, libtcod.white)
        # libtcod.console_set_default_background(new_console, libtcod.blue)
        libtcod.console_clear(new_console)
        tcod_consoles[id(con)] = new_console

    tcod_cons = tcod_consoles[id(con)]

    # if con.dirty:
    #     libtcod.console_clear(tcod_cons)
    #     con.dirty = False

    libtcod.console_print_frame(tcod_cons, 0, 0, con.w, con.h,
                                # False, # BACKGROUND_FLAG, title
                                )
    # /TEMPO!

    # for i, msg in enumerate(con.msgs[-(8+offset):-(offset)]):
    offset = 1 # TEMPO
    for i, msg in enumerate(con.last_msgs[-(con.h-2):]):
        libtcod.console_set_default_foreground(tcod_cons,
                                                getattr(colors, msg.col))
        libtcod.console_print_rect(
            tcod_cons, 1, offset, con.w-2, con.h-2, msg.txt
        )
        offset += libtcod.console_get_height_rect(
            tcod_cons, 1, offset, con.w-2, con.h-2, msg.txt
        )

    libtcod.console_blit(tcod_cons, 0, 0, con.w, con.h, blit_on, x, y,)