Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - infinity

Pages: [1]
1
I really enjoy using your terminal so far, however I recently stumbled upon a possible bug. I am using the python version 0.15.3 of bearlibterminal. In my game, you move around using the numpad keys (terminal.TK_KP_1, terminal.TK_KP_2, ... terminal.TK_KP_9) to allow 8-directional movement. Today I tried to implement a sprinting mechanic, where you can hold shift to sprint and move faster. This requires calling the terminal.check(terminal.TK_SHIFT) function to check if the shift key is being held down along with the movement key. However, the function returns False regardless of whether or not the shift key is held down. This is odd, because the function works correctly along with almost all other keys (including the conventional 4-direction arrow keys). Here is a short python code to test yourself.


from bearlibterminal import terminal

if __name__ == "__main__":
    terminal.open()
    terminal.set("window: size=100x50")

    while True:
        terminal.refresh()

        key = terminal.read()
        if terminal.check(terminal.TK_SHIFT):
           print 'shift held'
        else:
           print 'shift not held'
        if key == terminal.TK_ESCAPE:
            break

    terminal.close()


On my computer, the program prints 'shift not held' when I hold down shift and then press a numpad key, but prints 'shift held' when I hold down shift and press almost any other key (I haven't tested every key).

EDIT:
Upon digging a bit further, I realize that the function works when I set number lock off, but doesn't work when number lock is on.

2
Great program, but I seem to have trouble printing unicode characters (ex. β) in Python. Could anyone give me an example of how I would get the terminal to print unicode characters as well as ASCII? I am using DejaVu fonts so they support unicode.

Pages: [1]