Beispiel #1
0
 def render_intro(self, intro_text):
     libtcod.console_print_center(self.con2, SCREEN_WIDTH / 3, (SCREEN_HEIGHT /3) , libtcod.BKGND_ADD, intro_text)
     # do a cross-fading from off1 to off2
     for i in range(1, 110):
         libtcod.console_blit(self.con, 0, 0, 80, 50, 0, 0, 0) # renders the first screen (opaque)
         libtcod.console_blit(self.con2, 0, 0, 80, 50, 0, 0, 0, i / 128.0,
                              i / 128.0) # renders the second screen (transparent)
         libtcod.console_flush()
     libtcod.console_wait_for_keypress(True)
     for i in range(1, 128):
         libtcod.console_blit(self.con2, 0, 0, 80, 50, 0, 0, 0) # renders the first screen (opaque)
         libtcod.console_blit(self.con, 0, 0, 80, 50, 0, 0, 0, i / 128.0,
                              i / 128.0) # renders the second screen (transparent)
         libtcod.console_flush()
Beispiel #2
0
def readLine():
    line = ''
    while True:
        key = libtcod.console_wait_for_keypress(True)
        #No need to react on service keys
        if key.vk == libtcod.KEY_ESCAPE or key.c == 'x':
            return None
        if key.c == '\n':
            return line
        line += chr(key.c)
def readLine():
    line = ''
    while True:
        key = libtcod.console_wait_for_keypress(True)
        #No need to react on service keys
        if key.vk == libtcod.KEY_ESCAPE or key.c == 'x':
            return None
        if key.c == '\n':
            return line
        line += chr(key.c)
Beispiel #4
0
def readkey():
    while True:
        key = libtcod.console_wait_for_keypress(True)
        #No need to react on service keys
        if key.vk == libtcod.KEY_ENTER and libtcod.KEY_ALT:
            #Alt+Enter: toggle fullscreen
            libtcod.console_set_fullscreen(not libtcod.console_is_fullscreen())
            continue
        if key.vk in [libtcod.KEY_SHIFT, libtcod.KEY_CONTROL, libtcod.KEY_ALT, libtcod.KEY_CAPSLOCK]:
            continue
        if key.c != 0 and chr(key.c) not in '\x1b\n\r\t':
            s = chr(key.c)
            if key.shift:
                s = s.upper()
            return s
        elif key.vk:
            return key.vk
Beispiel #5
0
def readkey():
    while True:
        key = libtcod.console_wait_for_keypress(True)
        #No need to react on service keys
        if key.vk == libtcod.KEY_ENTER and libtcod.KEY_ALT:
            #Alt+Enter: toggle fullscreen
            libtcod.console_set_fullscreen(not libtcod.console_is_fullscreen())
            continue
        if key.vk in [
                libtcod.KEY_SHIFT, libtcod.KEY_CONTROL, libtcod.KEY_ALT,
                libtcod.KEY_CAPSLOCK
        ]:
            continue
        if key.c != 0 and chr(key.c) not in '\x1b\n\r\t':
            s = chr(key.c)
            if key.shift:
                s = s.upper()
            return s
        elif key.vk:
            return key.vk
Beispiel #6
0
def handle_keys(self, call_back):
    key = libtcod.console_wait_for_keypress(True)
Beispiel #7
0
def handle_keys(self, call_back):
    key = libtcod.console_wait_for_keypress(True)