2017-10-21 14:52:35 +00:00
|
|
|
//
|
|
|
|
// Keyboard.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 10/10/2017.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-10-21 14:52:35 +00:00
|
|
|
//
|
|
|
|
|
2024-01-17 04:34:46 +00:00
|
|
|
#pragma once
|
2017-10-21 14:52:35 +00:00
|
|
|
|
2024-03-04 16:31:25 +00:00
|
|
|
#include "../../KeyboardMachine.hpp"
|
|
|
|
#include "../../Utility/Typer.hpp"
|
2017-10-21 14:52:35 +00:00
|
|
|
|
|
|
|
namespace Electron {
|
|
|
|
|
|
|
|
enum Key: uint16_t {
|
|
|
|
KeySpace = 0x0000 | 0x08, KeyCopy = 0x0000 | 0x02, KeyRight = 0x0000 | 0x01,
|
|
|
|
KeyDelete = 0x0010 | 0x08, KeyReturn = 0x0010 | 0x04, KeyDown = 0x0010 | 0x02, KeyLeft = 0x0010 | 0x01,
|
|
|
|
KeyColon = 0x0020 | 0x04, KeyUp = 0x0020 | 0x02, KeyMinus = 0x0020 | 0x01,
|
|
|
|
KeySlash = 0x0030 | 0x08, KeySemiColon = 0x0030 | 0x04, KeyP = 0x0030 | 0x02, Key0 = 0x0030 | 0x01,
|
|
|
|
KeyFullStop = 0x0040 | 0x08, KeyL = 0x0040 | 0x04, KeyO = 0x0040 | 0x02, Key9 = 0x0040 | 0x01,
|
|
|
|
KeyComma = 0x0050 | 0x08, KeyK = 0x0050 | 0x04, KeyI = 0x0050 | 0x02, Key8 = 0x0050 | 0x01,
|
|
|
|
KeyM = 0x0060 | 0x08, KeyJ = 0x0060 | 0x04, KeyU = 0x0060 | 0x02, Key7 = 0x0060 | 0x01,
|
|
|
|
KeyN = 0x0070 | 0x08, KeyH = 0x0070 | 0x04, KeyY = 0x0070 | 0x02, Key6 = 0x0070 | 0x01,
|
|
|
|
KeyB = 0x0080 | 0x08, KeyG = 0x0080 | 0x04, KeyT = 0x0080 | 0x02, Key5 = 0x0080 | 0x01,
|
|
|
|
KeyV = 0x0090 | 0x08, KeyF = 0x0090 | 0x04, KeyR = 0x0090 | 0x02, Key4 = 0x0090 | 0x01,
|
|
|
|
KeyC = 0x00a0 | 0x08, KeyD = 0x00a0 | 0x04, KeyE = 0x00a0 | 0x02, Key3 = 0x00a0 | 0x01,
|
|
|
|
KeyX = 0x00b0 | 0x08, KeyS = 0x00b0 | 0x04, KeyW = 0x00b0 | 0x02, Key2 = 0x00b0 | 0x01,
|
|
|
|
KeyZ = 0x00c0 | 0x08, KeyA = 0x00c0 | 0x04, KeyQ = 0x00c0 | 0x02, Key1 = 0x00c0 | 0x01,
|
|
|
|
KeyShift = 0x00d0 | 0x08, KeyControl = 0x00d0 | 0x04, KeyFunc = 0x00d0 | 0x02, KeyEscape = 0x00d0 | 0x01,
|
|
|
|
|
2020-03-06 02:01:30 +00:00
|
|
|
// Virtual keys.
|
2021-01-31 17:25:22 +00:00
|
|
|
KeyF1 = 0xfff0, KeyF2, KeyF3, KeyF4, KeyF5, KeyF6, KeyF7, KeyF8, KeyF9, KeyF0,
|
2020-03-06 02:01:30 +00:00
|
|
|
|
2017-10-21 14:52:35 +00:00
|
|
|
KeyBreak = 0xfffd,
|
|
|
|
};
|
|
|
|
|
2024-12-01 22:51:20 +00:00
|
|
|
constexpr bool is_modifier(const Key key) {
|
2021-01-31 17:25:22 +00:00
|
|
|
return (key == KeyShift) || (key == KeyControl) || (key == KeyFunc);
|
|
|
|
}
|
|
|
|
|
2020-04-02 03:19:34 +00:00
|
|
|
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
2020-05-21 03:34:26 +00:00
|
|
|
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) const final;
|
2017-10-21 14:52:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CharacterMapper: public ::Utility::CharacterMapper {
|
2020-05-21 03:34:26 +00:00
|
|
|
const uint16_t *sequence_for_character(char character) const override;
|
2020-03-01 00:26:15 +00:00
|
|
|
|
2020-05-21 03:34:26 +00:00
|
|
|
bool needs_pause_after_reset_all_keys() const override { return false; }
|
|
|
|
bool needs_pause_after_key(uint16_t key) const override;
|
2017-10-21 14:52:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|