floooh / chips

8-bit chip and system emulators in standalone C headers
zlib License
994 stars 76 forks source link

Support numberpad keys on CPC #7

Open floooh opened 5 years ago

floooh commented 5 years ago

...the CPC numberpad keys should be mapped to PC numberpad keys....

elixx commented 5 years ago

Might it be possible to make the "Keyboard Map" clickable to send keyboard inputs? That might be a viable workaround for all platforms -- I'd really like to be able to send the PAUSE-BREAK key to the C64...

floooh commented 5 years ago

That's a good idea, in YAKC (https://floooh.github.io/virtualkc/) I had a general onscreen keyboard UI, but this is hardwired to one computer model (the KC85/3), using the information in the keyboard map for a "universal keyboard", maybe with a different UI which actually looks like a keyboard might work...

Emulator stuff isn't currently high on my todo list, but I'll keep it in mind :)

elixx commented 5 years ago

Thanks. The C64's choice of keys always kind of bugged me..

m1zar commented 4 years ago

Hi, firstly thanks for these great emulators, I like the approach and appreciate the perfect sound. And the UI versions implementation is one of the best I've ever seen. However, I think the keyboard handling might need looking at. I think having an option of emulated machine layout and PC layout might be better. If you try and program the spectrum, you can't get all the commands for some reason. Missing SymbolShift? Which kind of means you can't program it. Also there is something not right with the response. For example if you press a key, the response on the first char is great, then there is the repeat delay, it repeats the char once only, then there is a second repeat delay followed by repeating chars. At the moment the sims are great to look at, and I wish I could use them all the time, but I need to type on them. This also affects many keyboard only games, where it appears it doesn't support more than one key-press at a time. On the spectrum, you can play many with the joystick-arrow keys, which works fine, but I would like to be able to use the keys, as I find manic miner easier with OP and space. :o) I really just wan't these to be perfect. Thanks, James.

floooh commented 4 years ago

I agree, while the current way host system keys are mapped to the target system keys is quite convenient for regular text input, it fails for target-specific keys.

I want to add some sort of onscreen keyboard UI to fix this (and this could also have a mode-toggle to switch the host keyboard mapping to other modes). However I didn't want to use Dear ImGui for this (which is used in the debugging UI), because this adds too much binary size overhead (I still want the 'core emulators' without the debugging UI to remain as small as possible)...

So the plan is to render the custom onscreen keyboard with a mix of sokol_gl.h (https://github.com/floooh/sokol/blob/master/util/sokol_gl.h) and sokol_debugtext.h (https://github.com/floooh/sokol/blob/master/util/sokol_debugtext.h), and also spend a bit of time to add some 'system-specific polish' to those virtual keyboards (e.g. the ZX Spectrum onscreen keyboard should somehow feature the iconic 'rainbow stripes' in the bottom right corner). This virtual keyboard would also fix all text input problems on mobile devices (since the iOS and Android onscreen keyboards are even worse than PC keyboards for emulator input).

...and I also want to use the same idea to implement a virtual touch-input-joystick on mobile devices btw.

m1zar commented 4 years ago

Hi Floooh, Thanks for that, good news, an on-screen keyboard would be nice for touch devices and solve the translation problem (ZX<->IBM layouts) so whatever the keyboard you have you at least have a way to input any potential missing/miss-mapped keys, and I would certainly make use of it. I also like small code, it tends to naturally be faster and more efficient. I enjoyed reading some of your development blog and your enhancements of the CPU clock timings, was a really interesting read. What you've done with the sound and video display is excellent, and I look forward to following your developments on this and all your other, equally excellent, emulators. Most of all, thanks for writing them!