def main_menu():

    while True:
        terminal.clear()
        for y in range(50):
            for x in range(80):
                terminal.color(1678238975 - x)
                terminal.put(x, y, 20)

        terminal.refresh()

        #show the game's title and some credits
        terminal.layer(6)
        terminal.color(4294967103)
        terminal.print_(SCREEN_WIDTH/2 - 10, SCREEN_HEIGHT/2-4, 'CAVES OF THE SNAILMEN')
        terminal.print_(SCREEN_WIDTH/2, SCREEN_HEIGHT-2, 'By Tommy Z')

        #show options and wait for player's choice
        choice = menu('', ['Play a new game', 'Continue last game', 'Save & Quit'], 24)

        if choice == 0:  #new game
            terminal.clear()
            new_game()
            play_game()
        if choice == 1:  #load last game
            try:
                load_game()
            except:
                msgbox('\n No saved game to load.\n', 24)
                continue
            play_game()
        elif choice == 2:  #quit

            terminal.close()
            break
Beispiel #2
0
def main():
    global WINDOW_WIDTH, WINDOW_HEIGHT, CELLSIZE
    blt.open_()
    blt.set_("window: size={}x{}, cellsize={}, title='Grid Test';"
             "font: default".format(
                 str(WINDOW_WIDTH), str(WINDOW_HEIGHT), CELLSIZE))
    blt.clear()
    blt.refresh()
    blt.color("white")
    g = Quadrant()
    blt.clear()
    for x in range(30):
        for y in range(30):
            if [x, y] in g.all_nodes:
                blt.print_(x * 2, y * 2, 'O')
            elif [x, y] in g.roads:
                # if x != 0 and x != 10 and y != 0 and y != 10:
                    # blt.layer(1)
                # blt.print_(x * 2, y * 2, str(g.roads.index([x, y])))
                    # blt.layer(0)
                # else:
                blt.print_(x * 2, y * 2, '+')
    blt.refresh()

    proceed = True
    while proceed:
        key = 0
        while blt.has_input():
            key = blt.read()
            if key == blt.TK_CLOSE or key == blt.TK_Q:
                proceed = False
    blt.close()
Beispiel #3
0
 def cleanup(self):
     terminal.close()
Beispiel #4
0
bl.open()
bl.refresh()
SCREEN_WIDTH = bl.state(bl.TK_WIDTH)
SCREEN_HEIGHT = bl.state(bl.TK_HEIGHT)

the_map = Map(SCREEN_WIDTH, SCREEN_HEIGHT, 3, 3, 9, 9)
at = AtMan(5, 5, the_map)
left_apostrophe = MapChild(0, 1, "'", the_map)
right_apostrophe = MapChild(2, 1, "'", the_map)
dud = MapChild(4, 4, "\u2193", the_map)
the_map.draw_view()
eventhandler.register(the_map, *ARROW_EVENTS + WASD_EVENTS)

menu = ui.Menu(60, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1)

paint(gridtools.hollow_rectangle(2, 2, 10, 10))
paint(gridtools.rectangle(60, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1))

while True:
    drawing_system.run()
    ui_drawing_system.run()
    event = bl.read()
    if event == bl.TK_CLOSE or event == bl.TK_ESCAPE:
        break

    eventhandler.fire(event)
    bl.put(1, 1, bl.state(bl.TK_WCHAR))
    bl.refresh()

bl.close()
Beispiel #5
0
import PyBearLibTerminal as terminal

terminal.open()
terminal.printf(2, 1, "β")
terminal.put(2, 2, "β")
terminal.refresh()
while True:
    if terminal.has_input():
        key = terminal.read()
        print(key)
        if key == terminal.TK_Q | terminal.TK_KEY_RELEASED:
            print("released")
            break
        elif key == terminal.TK_Q:
            break
terminal.close()
Beispiel #6
0
    color10 = bltColor('sky')
    line.draw_line((l1[0], l1[1]), (l2[0], l2[1]), color10)

    terminal.color(bltColor('255, 255,64,64'))
    terminal.print_(15, 8, "[wrap=25x5][align=left-bottom]Hello my name is rudy!!!!!!!! I want to be your friend")



    terminal.color('yellow')
    terminal.printf(l2[0] + 1, l2[1], '<')



    terminal.refresh()

    if terminal.has_input():
        key = terminal.read()
    if key == terminal.TK_CLOSE:
        break
    elif key == terminal.TK_UP:
        l2 = (l2[0], l2[1] - 1)
    elif key == terminal.TK_DOWN:
        l2 = (l2[0], l2[1] + 1)
    elif key == terminal.TK_LEFT:
        l2 = (l2[0] - 1, l2[1])
    elif key == terminal.TK_RIGHT:
        l2 = (l2[0] + 1, l2[1])


terminal.close()