itsapi / pycraft

A Minecraft-inspired game for the terminal
GNU General Public License v2.0
197 stars 21 forks source link

Improve pycraft input #98

Closed geraintwhite closed 8 years ago

geraintwhite commented 8 years ago

Add arrow keys support to game Currently arrow keys seem to get buffered (one key too late) Fixes #92

geraintwhite commented 8 years ago

I suppose its current state is better than what it was doing before?

olls commented 8 years ago

We probably need to access the key-presses in a queue to get this to work properly... But what is the point, most games which support wasd don't support arrow keys as well.

geraintwhite commented 8 years ago

Most games support both, and I would have thought it arrow keys are supported in part of the game (menus), they should be supported throughout.

olls commented 8 years ago

Minecraft doesn't. I think the fact that we have two handed controls also argues against this. We can try it, but I think the input code will be much more complex though.

olls commented 8 years ago

This current version breaks input() calls. I wrote it to fit into the old system (NonBlockingInput, BlockingInput classes), but I think the system needs changing so we can switch between the two more easily (and disable non blocking input while in input() calls).

geraintwhite commented 8 years ago

Python 3.2 and Python 3.4 when trying to load a save.

Traceback (most recent call last):
  File "main.py", line 312, in <module>
    main()
  File "main.py", line 19, in main
    game(blocks, *ui.main())
  File "main.py", line 153, in game
    print(out)
BlockingIOError: [Errno 11] write could not complete without blocking
geraintwhite commented 8 years ago

Is there any point still doing this? I agree that arrow keys aren't necessary in NBI.