2018-02-09 21:31:05 +00:00
|
|
|
//
|
|
|
|
// MultiKeyboardMachine.cpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 09/02/2018.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2018 Thomas Harte. All rights reserved.
|
2018-02-09 21:31:05 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#include "MultiKeyboardMachine.hpp"
|
|
|
|
|
|
|
|
using namespace Analyser::Dynamic;
|
|
|
|
|
|
|
|
MultiKeyboardMachine::MultiKeyboardMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines) {
|
|
|
|
for(const auto &machine: machines) {
|
|
|
|
KeyboardMachine::Machine *keyboard_machine = machine->keyboard_machine();
|
2018-02-19 21:06:46 +00:00
|
|
|
if(keyboard_machine) machines_.push_back(keyboard_machine);
|
2018-05-05 23:32:20 +00:00
|
|
|
}
|
2018-02-09 21:31:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MultiKeyboardMachine::clear_all_keys() {
|
|
|
|
for(const auto &machine: machines_) {
|
|
|
|
machine->clear_all_keys();
|
2018-05-05 23:32:20 +00:00
|
|
|
}
|
2018-02-09 21:31:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MultiKeyboardMachine::set_key_state(uint16_t key, bool is_pressed) {
|
2018-05-05 23:32:20 +00:00
|
|
|
for(const auto &machine: machines_) {
|
|
|
|
machine->set_key_state(key, is_pressed);
|
|
|
|
}
|
2018-02-09 21:31:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MultiKeyboardMachine::type_string(const std::string &string) {
|
2018-05-05 23:32:20 +00:00
|
|
|
for(const auto &machine: machines_) {
|
|
|
|
machine->type_string(string);
|
|
|
|
}
|
2018-02-09 21:31:05 +00:00
|
|
|
}
|
|
|
|
|
2018-10-25 01:59:30 +00:00
|
|
|
Inputs::Keyboard &MultiKeyboardMachine::get_keyboard() {
|
|
|
|
return keyboard_;
|
2018-02-09 21:31:05 +00:00
|
|
|
}
|
2018-10-25 01:59:30 +00:00
|
|
|
|
|
|
|
//void MultiKeyboardMachine::keyboard_did_change_key(Inputs::Keyboard *keyboard, Inputs::Keyboard::Key key, bool is_pressed) {
|
|
|
|
// for(const auto &machine: machines_) {
|
|
|
|
// uint16_t mapped_key = machine->get_keyboard_mapper()->mapped_key_for_key(key);
|
|
|
|
// if(mapped_key != KeyNotMapped) machine->set_key_state(mapped_key, is_pressed);
|
|
|
|
// }
|
|
|
|
//}
|