UnicornConsole icon indicating copy to clipboard operation
UnicornConsole copied to clipboard

True keyboard mode

Open Tenchi2xh opened this issue 7 years ago • 7 comments

Something I felt terribly missing from the original Pico8 was the lack of true keyboard support. I had tons of ideas that I could just not implement because there was no real keyboard input (create a tiny terminal, text adventure, an OS etc.)

Could it be possible to have a true keyboard mode, either activated programatically or with an environment variable?

That would effectively extend PX8 to be a Fantasy Microcomputer in addition to a Fantasy Console!

Tenchi2xh avatar Apr 23 '17 07:04 Tenchi2xh

Have you some example to have a better understanding ?

hallucino avatar Apr 23 '17 08:04 hallucino

Basically a mode where when you boot, you don't have 2 joypads, but instead each key on the keyboard is a different event.

For example, instead of btn(4) and btn(5) being the two buttons on the controller for example, btn(n) would represent the key of ASCII n being pressed.

Tenchi2xh avatar Apr 23 '17 08:04 Tenchi2xh

So if I want to make a game where you move using the W A S D keys (Z Q S D in France I think) I would have something like (in Python):

if btn(119):   # or more easily btn(ord('w'))
  # go up
elif btn(115):
  # go down
...

Tenchi2xh avatar Apr 23 '17 09:04 Tenchi2xh

It seems a good idea, I need to figure out how to do that

hallucino avatar Apr 24 '17 06:04 hallucino

You could try this feature with: btn('a') or btnp('a') for example, it should work with python

hallucino avatar May 19 '17 08:05 hallucino

  • [X] Add API
  • [X] Add python binding
  • [ ] add the lua binding
  • [ ] add the doc

hallucino avatar May 19 '17 08:05 hallucino

@Tenchi2xh do you want to test it ?

hallucino avatar Jul 14 '17 08:07 hallucino