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;
|
|
|
|
|
|
|
|
Machine::Machine() {
|
|
|
|
keyboard_.set_delegate(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Machine::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);
|
|
|
|
}
|
|
|
|
|
2017-10-15 02:07:11 +00:00
|
|
|
void Machine::reset_all_keys(Inputs::Keyboard *keyboard) {
|
2017-10-13 02:25:02 +00:00
|
|
|
// TODO: unify naming.
|
|
|
|
clear_all_keys();
|
|
|
|
}
|
|
|
|
|
|
|
|
Inputs::Keyboard &Machine::get_keyboard() {
|
|
|
|
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
|
|
|
|
|
|
|
Machine::KeyboardMapper *Machine::get_keyboard_mapper() {
|
|
|
|
return nullptr;
|
|
|
|
}
|