Open ecstaticax opened 4 years ago
your work is really great. Do you think you will add Amiga and 128? Thanks
And CPC 6128 :-)
They are all within the scope of this project, and I've already thought about adding them.
However, adding a new computer is a lot of work:
Help on any of that (or any other part of the app, including documentation) would be most welcome. Currently, I'm the only one working on this project.
Hi, I presume it's a very time consuming work. I can try to find a photo of the Amiga and 128 keyboards and try to adapt them. But I don't know if it will be good. If not, you will trash them. What do I need to do about size and so on? Regards. Gianluca
You're looking for a photo that is straight from the top, ideally 3000-4000 pixels wide.
Also, you need permission to use the photo: either it's distributed under Creative Commons or similar (Wikipedia is a good source for this), it's your own photo, or you ask the photographer for permission to use it in an open source emulator.
Make sure the edges of the keyboard are straight and parallel to the edges of the image. I use Lightroom on iPad to straighten the image (with the Geometry tool), other programs should have similar tools.
Then you trim it so there is a border about half a key wide. If there are multiple blocks of keys, bring them closer together so the gap is also about half a key wide (e. .g the function keys on C64). Cut out the case, making the regions transparent. If there is writing on the case (e. g. ZX Spectrum), leave that there (best to make a flood color selection of the case color and cut that).
I have a German C128, if you want to start there, I can send you a photo.
Yes, send it to me and I will do my best. Regards
Here you go. I already straightened it. The gaps between the key blocks are small enough, you can leave them as they are.
Also, could you please fill in the pixel measurements below:
The rest should hopefully be self explanatory, if not feel free to ask.
For measurements at the edge of a key block, use the edge between the removed case and the remaining black background. For measurements between keys, use the middle between the top of the key caps.
"C128 DE": Keyboard(c128WithImageName: "Commodore 128 DE Keyboard",
rows: [],
left: ,
right: ,
controlRight: ,
restoreLeft: ,
returnLeft: ,
leftShiftLeft: ,
leftShiftRight: ,
rightShiftLeft: ,
rightShiftRight: ,
spaceLeft: ,
spaceRight: ,
keypadLeft: ,
keypadRight: ,
keypad0Right: ,
functionRowTop: ,
functionRowBottom: ,
functionBlock1Right: ,
functionBlock2Left: ,
functionBlock2Right: ,
funcitonBlock3Right: ),
thanks, db
Hi, I created the image, I have some problems to understand the pixel values. Is the image ok? Regards.
Please restore the vertical space between the top row of keys (dark grey) and the rest. Otherwise it looks great.
Here some examples of the values I mean, measured in your picture; hope this makes things clearer:
rows: [237, 414, ...]
left: 59,
right: 2739,
controlRight: 298,
...
Here it is:
` "C128 DE": Keyboard(c128WithImageName: "Commodore 128 DE Keyboard", rows: [345,511,680,848,1014,1177], left: 59, right: 2739, controlRight: 298, restoreLeft: 2500, returnLeft: 2420, leftShiftLeft: 238, leftShiftRight: 477, rightShiftLeft: 2178, rightShiftRight: 2404, spaceLeft: 659, spaceRight: 2159, keypadLeft: 2841, keypadRight: 3505, keypad0Right: 3168, functionRowTop: 113, functionRowBottom: 272, functionBlock1Right: 735, functionBlock2Left: 1074, functionBlock2Right: 1737, functionBlock3Right: 2740), functionBlock4Right: 3510),
`
Thank you, this looks great.
If you want some other keyboards and have pictures, I can help!
Could you please take measurements for this keyboard?
Don't bother with the cursor keys, I'll compute them from the other measurements.
Thanks.
To avoid misunderstandings: this will need a different set of measurements than the C128 keyboard. Looking at what we measured for C128 should give you a good idea what we will need here. If you have any questions, feel free to ask. If you want to, you can contact me per email. My address is dillo@nih.at.
I am working on it now
“Amiga DE": Keyboard(AmigaWithImageName: "Commodore Amiga DE Keyboard", rows: [173,274,364,458,554,646], left: 36, right: 1475, controlRight: 150, returnLeft: 1350, leftShiftLeft: 47, leftShiftRight: 196, rightShiftLeft: 1218, rightShiftRight: 1470, spaceLeft: 338, spaceRight: 1163, leftAltLeft: 113, leftAltRight: 226, rightAltLeft: 1283, rightAltRight: 1405, keypadLeft: 1830, keypadRight: 2213, keypad0Right: 2019, functionRowTop: 34, functionRowBottom: 142, functionBlock1Right: 756, functionBlock2Left: 794, functionBlock2Right: 1380),
Great, thanks.
There are just a few measurements missing: tildeRight tabRight returnUpperLeft returnLowerLeft cursorLeft (for the whole del/help/cursor block) cursorRight escapeRight functionBlock1Left
Also, these two are unnecessary (Alt and Amiga keys have the same width): leftAltRight, rightAltLeft
The next two steps are writing the actual init function and the key to symbol mapping. Would you be willing to tackle those as well?
The init function is in Emulator/Keyboard.swift. c128WithImageName is a good place to start, they have a similar layout. Key names are defined in Emulator/Key.swift; feel free to add new ones if none of the existing fits. CapsLock is the only toggle key.
This defines the hit zones of each key, grouped into rows (all keys with the same top and bottom edges), and within that into spans (adjacent keys of the same width). Double high keys are simply included in both rows.
The symbol mapping is in Emulator/KeyboardSymbols.swift. Again c128 should be a good starting point.
This maps keys from the Amiga keyboard to keys on the hardware keyboard connected to the iPad. If you're not sure which key to map to, just add a comment with the key name (so we see that it's not mapped yet).
“Amiga DE": Keyboard(AmigaWithImageName: "Commodore Amiga DE Keyboard",
rows: [173,274,364,458,554,646],
left: 36,
right: 1475,
controlRight: 150,
leftShiftLeft: 47,
leftShiftRight: 196,
rightShiftLeft: 1218,
rightShiftRight: 1470,
spaceLeft: 338,
spaceRight: 1163,
leftAltLeft: 113,
rightAltRight: 1405,
keypadLeft: 1830,
keypadRight: 2213,
keypad0Right: 2019,
functionRowTop: 34,
functionRowBottom: 142,
functionBlock1Left: 174,
functionBlock1Right: 756,
functionBlock2Left: 794,
functionBlock2Right: 1380,
tildeRight: 172,
tabRight: 223,
returnUpperLeft:1326,
returnLowerLeft:1355,
cursorLeft: 1508,
cursorRight: 1794,
escapeRight: 140),
Let me know if I did the latest keys correctly, I also tried to modify Key.swift, but it's the first time I use github... If it's ok I will tro to edit Keyboard.swift...
The following measurements are unnecessary: leftShiftLeft (use left) rightShiftRight (use right) leftAltRight (use a span from leftAltLeft to spaceLeft with keys .AltLeft and .AmigaLeft) rightAltleft
Otherwise they look great.
If you don't want to use git/GitHub, just download the raw version of the files and send me the edited versions (via email is probably best). Your changes should be easy enough for me to integrate.
I also cannot understand why I input with the "code" option on github, and they are not formatted :-(
For multi-line code, use triple backtick followed by the language used (swift in our case):
```swift func foo() -> Bar { return Bar() } ```
produces
func foo() -> Bar {
return Bar()
}
your work is really great. Do you think you will add Amiga and 128? Thanks