コード例 #1
0
ファイル: main.py プロジェクト: openspaceaarhus/Foodputer
    dt = clock.tick(90)
    walltime += dt
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            quit()

        if not hasattr(event, "key"):
            continue

        if not event.type == pygame.KEYDOWN:
            continue

        if event.key == pygame.K_RETURN:
            Foodputer.handle_input(strbuf)
            strbuf = ""
            GUI.set_charcount(len(strbuf))
        elif event.key == pygame.K_ESCAPE:
            quit()

        # manually store the valid input as a unicode-char-buffer
        key = event.unicode
        if valid_id_char(key):
            # print "valid"
            strbuf += key
            GUI.set_charcount(len(strbuf))

    # update the screen
    surface.fill(BG)
    GUI.Screen.state.update(dt)

    # draw stuff