mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
78ee46270b
Specifically by establishing an intermediate representation of a useful mix between the American and British IBM and Mac keyboard layouts, and routing through that.
36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
//
|
|
// KeyboardMapper.cpp
|
|
// Clock Signal
|
|
//
|
|
// Created by Thomas Harte on 10/10/2017.
|
|
// Copyright © 2017 Thomas Harte. All rights reserved.
|
|
//
|
|
|
|
#include "KeyboardMapper.hpp"
|
|
#include "ZX8081.hpp"
|
|
|
|
using namespace ZX8081;
|
|
|
|
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
|
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return ZX8081::dest
|
|
switch(key) {
|
|
default: break;
|
|
|
|
BIND(k0, Key0); BIND(k1, Key1); BIND(k2, Key2); BIND(k3, Key3); BIND(k4, Key4);
|
|
BIND(k5, Key5); BIND(k6, Key6); BIND(k7, Key7); BIND(k8, Key8); BIND(k9, Key9);
|
|
BIND(Q, KeyQ); BIND(W, KeyW); BIND(E, KeyE); BIND(R, KeyR); BIND(T, KeyT);
|
|
BIND(Y, KeyY); BIND(U, KeyU); BIND(I, KeyI); BIND(O, KeyO); BIND(P, KeyP);
|
|
BIND(A, KeyA); BIND(S, KeyS); BIND(D, KeyD); BIND(F, KeyF); BIND(G, KeyG);
|
|
BIND(H, KeyH); BIND(J, KeyJ); BIND(K, KeyK); BIND(L, KeyL);
|
|
BIND(Z, KeyZ); BIND(X, KeyX); BIND(C, KeyC); BIND(V, KeyV);
|
|
BIND(B, KeyB); BIND(N, KeyN); BIND(M, KeyM);
|
|
|
|
BIND(LeftShift, KeyShift); BIND(RightShift, KeyShift);
|
|
BIND(FullStop, KeyDot);
|
|
BIND(Enter, KeyEnter);
|
|
BIND(Space, KeySpace);
|
|
}
|
|
#undef BIND
|
|
return KeyboardMachine::Machine::KeyNotMapped;
|
|
}
|