Comments (18)
problem 3: well this one we could repair ... should we ?
Yes, yes, yes. Having Y and Z switched is the most annoying thing in most C64 emulators.
VC64mac distinguishes between symbolic and positional key mapping. In symbolic mapping, key characters are evaluated ("Y") whereas in positional mapping, key codes are evaluated (#XXX). Symbolic mapping is more important than positional mapping (and the default in VC64mac). I think this should be supported. For everything else, there is the virtual keyboard.
from virtualc64web.
keyboard test prg π
https://csdb.dk/release/?id=98411
virtualc64web test result firefox mac german keyboard ....
gray keys are not yet reachable ... that is you can not type them by any combination of keys ... effectively unmappedπ
from virtualc64web.
virtualc64web test result iOS safari german keyboard (brand: Anker....)
problem 1: the anker bluetooth keyboard does not emit a keydown for the function keys in safari iOS
problem 2: some keys are not reachable in macOS and iOS
problem 3: keys are mapped according to their position on the 64 keyboard ... that makes Y and Z swapped
from virtualc64web.
VirtualC64web needs a virtual keyboard π.
from virtualc64web.
yes I see it too and iOS needs a touch screen based joystick emulation ...π tons off work though ... but if we make it clever then we can reuse all the stuff we have yet to implement when we make the vAmigaweb edition ...
from virtualc64web.
there are some on the web ...
this one is huge ... over 100 kb ... too big for my taste ...
https://mottie.github.io/Keyboard/
this tiny one here is nice ... only 14 kb ... maybe a candidate ?
https://github.com/mBut/jquery.mlkeyboard/
And a bootstrap3.3 conversation of it here https://github.com/eamigo86/jquery.keyboard
or we can do on our own one ...
from virtualc64web.
this tiny one here is nice ... maybe a candidate ?
Yes, that one is very nice π₯°. Hopefully, it's easy to change it into a C64 keyboard, but I guess the code isn't too complicated.
from virtualc64web.
I played with some virtual keyboards. Some are nice. Based on your good experience in developing an own Moira CPU core instead of taking the musashi. I decided to develop our own keyboard now. From the ground up. The goal is the same ...it should give us the best user experience regardless which device will be used. π€€
from virtualc64web.
On restore the core complains with an assertion π and stops working
@dirkwhoffmann do you have an idea whats wrong with pressing restore?
the commodore key are right shift is still unmapped π
All other keys are working with vc64webs brand new toy βthe handcrafted virtual keyboardβ short HVK. π
On small devices (like iphone portrait mode) the keyboard turns automatically into a scrollable βtouchbarβ This way the keys stay still big enough to read and type on...
On large screens it centers automatically and scrolling is gone.
Published to https://dirkwhoffmann.github.io/virtualc64web/
One more thing... the keyboard supports
light and darkmode π€€
from virtualc64web.
the commodore key was easy ... it was just an mapping error
only left ... the following two problematic keys ...
right shift - how what are the correct two key codes ?
restore - gives the following
wasm_key ( 9, 9, 1 )
Assertion failed: row < 8, at: C64/Computer/Keyboard.cpp,129,pressKey
is the key code 9,9 wrong ? It is the second last in the following code
// Second physical key row
[7, 2], [7, 6], [1, 1], [1, 6], [2, 1], [2, 6], [3, 1], [3, 6],
[4, 1], [4, 6], [5, 1], [5, 6], [6, 1], [6, 6], [9, 9], [0, 5] /* f3 */,
I copied that code from the mac version ... and translated it into javascript ... file is vC64keymap.js
from virtualc64web.
is the key code 9,9 wrong ? It is the second last in the following code
It purposely produces an assertion failure to prevent anybody from trying to translate Restore to a key code π . Thing is, the restore key does not have a key code. This key is directly bound to the NMI line of the processor. You need to call a special API method to press it:
//! @brief Presses the restore key.
void pressRestoreKey();
Key codes of both shift keys are here:
//! @brief Checks if the shift lock key is held down.
bool shiftLockIsHoldDown() { return shiftLock; }
//! @brief Checks if the left shift key is currently pressed.
bool leftShiftIsPressed() { return keyIsPressed(1,7); }
//! @brief Checks if the right shift key is currently pressed.
bool rightShiftIsPressed() { return keyIsPressed(6,4); }
from virtualc64web.
BTW, I like the idea of implementing the virtual keyboard from ground up.
from virtualc64web.
HVK (handcrafted virtual keyboard passed all tests now) πππΏ
from virtualc64web.
lets review the problems ...
problem 1: the anker bluetooth keyboard does not emit a keydown for the function keys in safari iOS
problem 2: some keys are not reachable in macOS and iOS
problem 3: keys are mapped according to their position on the 64 keyboard ... that makes Y and Z swapped
problem 1 -- one picture says it all I think
they just dont like function keys .... the virtual keyboard heals this
problem 2: see the cmd key desaster https://github.com/dirkwhoffmann/virtualc64web/issues/32 ... the virtual keyboard heals this
problem 3: well this one we could repair ... should we ?
from virtualc64web.
I did set up a symbolic key map in vC64keymap.js, which has priority over positional mapping ...
function translateKey(keycode, key)
{
console.log('keycode='+keycode + ', key='+key);
var mapindex;
var sym_key = symbolic_map[key];
if(sym_key!== undefined)
{//if there is a symbolic mapping ... use it instead of the positional mapping
mapindex=key_translation_map[ sym_key ];
}
else
{//when there is no symbolic mapping fall back to positional mapping
mapindex=key_translation_map[ keycode ];
}
c64code=c64keymap[mapindex];
return c64code;
}
symbolic_map = {
z: 'KeyZ',
y: 'KeyY'
}
only two keys are in it ... we could add more ... Is this the way to go ? Or do you mean a setting in a config panel which toggles between symbolic and positional mapping ?
pushed to gh-pages π
from virtualc64web.
Is this the way to go ?
Yes, I think this is a fruitful approach. You might want to add keys such as "!","(",")" etc. These keys need a more sophisticated translation though, because they require to press the C64 shift key as well.
from virtualc64web.
Ok now I see ... when I ported
https://github.com/dirkwhoffmann/virtualc64/blob/master/OSX/MacGUI/C64Key.swift
to javascript some weeks ago I wasn't carefully and rushed through it ... in order to get quick results ... so I missed out this function
// Translates a character to a list of corresponding C64 keys
// This function is used for symbolically mapping Mac keys to C64 keys
static func translate(char: String?) -> [C64Key] {
if char == nil { return [] }
switch char! {
// First row of C64 keyboard
case "ΓΌ": return [C64Key.leftArrow]
case "1": return [C64Key.digit1]
case "!": return [C64Key.digit1, C64Key.shift]
I have to carefully redo the porting of this swift class to javascript ...
from virtualc64web.
I think I finished the symbolic mapping ... I ported the translate function ... Maybe it would be wise in a later version to use the c++ version instead of porting ...
from virtualc64web.
Related Issues (20)
- time_since_start can overflow after some time HOT 1
- Running C64-Cursor on iPad/Safari HOT 5
- compiling errors HOT 3
- cannot start D64 when building with latest emsdk HOT 5
- stuck physical keyboard on certain key combinations HOT 2
- Set other ROMs as default? HOT 5
- Does not load basic programs properly HOT 13
- margin-bottom on virtual keyboard for modern iOS devices HOT 1
- Bruce Lee crashes (any version) after several levels HOT 27
- setting action buttons on top of nav bar HOT 1
- improve mapping of (short cut) keys HOT 2
- work on defining actions and keyboard mappings
- Touch controls in iPhone HOT 41
- How does one drag a link from csdb.dk into the drop zone? HOT 4
- Touch controls in iPhone Part2 HOT 12
- use HOT 1
- xbox wireless controllers axis sticks HOT 1
- Touch example crashes on touch devices HOT 3
- Unable to select c64 roms on iOS HOT 2
- reworked css based virtual keyboard HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from virtualc64web.