2017-10-13 02:25:02 +00:00
|
|
|
//
|
|
|
|
// KeyboardMachine.cpp
|
|
|
|
// 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-13 02:25:02 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#include "KeyboardMachine.hpp"
|
|
|
|
|
|
|
|
using namespace KeyboardMachine;
|
|
|
|
|
2018-10-25 01:59:30 +00:00
|
|
|
MappedMachine::MappedMachine() {
|
2017-10-13 02:25:02 +00:00
|
|
|
keyboard_.set_delegate(this);
|
|
|
|
}
|
|
|
|
|
2018-10-25 01:59:30 +00:00
|
|
|
void MappedMachine::keyboard_did_change_key(Inputs::Keyboard *keyboard, Inputs::Keyboard::Key key, bool is_pressed) {
|
2018-02-09 21:31:05 +00:00
|
|
|
uint16_t mapped_key = get_keyboard_mapper()->mapped_key_for_key(key);
|
2017-10-13 02:25:02 +00:00
|
|
|
if(mapped_key != KeyNotMapped) set_key_state(mapped_key, is_pressed);
|
|
|
|
}
|
|
|
|
|
2018-10-25 01:59:30 +00:00
|
|
|
void MappedMachine::reset_all_keys(Inputs::Keyboard *keyboard) {
|
2017-10-13 02:25:02 +00:00
|
|
|
// TODO: unify naming.
|
|
|
|
clear_all_keys();
|
|
|
|
}
|
|
|
|
|
2018-10-25 01:59:30 +00:00
|
|
|
Inputs::Keyboard &MappedMachine::get_keyboard() {
|
2017-10-13 02:25:02 +00:00
|
|
|
return keyboard_;
|
|
|
|
}
|
2017-12-29 23:30:46 +00:00
|
|
|
|
|
|
|
void Machine::type_string(const std::string &) {
|
|
|
|
}
|
2018-02-09 21:31:05 +00:00
|
|
|
|
2018-10-25 01:59:30 +00:00
|
|
|
MappedMachine::KeyboardMapper *MappedMachine::get_keyboard_mapper() {
|
2018-02-09 21:31:05 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|