1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-28 09:54:49 +00:00

Formally declared the ZX80/81 and Amstrad CPC as keyboard machines in their public interface. Which means not having to repeat the meaning of set_key_state and clear_all_keys. So: a minor DRY improvement.

This commit is contained in:
Thomas Harte 2017-08-03 12:38:22 -04:00
parent c8f4de6f11
commit 575b1dba75
2 changed files with 6 additions and 10 deletions

View File

@ -11,6 +11,7 @@
#include "../ConfigurationTarget.hpp"
#include "../CRTMachine.hpp"
#include "../KeyboardMachine.hpp"
namespace AmstradCPC {
@ -50,19 +51,14 @@ enum Key: uint16_t {
*/
class Machine:
public CRTMachine::Machine,
public ConfigurationTarget::Machine {
public ConfigurationTarget::Machine,
public KeyboardMachine::Machine {
public:
/// Creates an returns an Amstrad CPC on the heap.
static Machine *AmstradCPC();
/// Sets the contents of rom @c type to @c data. Assumed to be a setup step; has no effect once a machine is running.
virtual void set_rom(ROMType type, std::vector<uint8_t> data) = 0;
/// Indicates that @c key is either pressed or released, according to @c is_pressed.
virtual void set_key_state(uint16_t key, bool is_pressed) = 0;
/// Indicates that all keys are now released.
virtual void clear_all_keys() = 0;
};
}

View File

@ -11,6 +11,7 @@
#include "../ConfigurationTarget.hpp"
#include "../CRTMachine.hpp"
#include "../KeyboardMachine.hpp"
#include <cstdint>
#include <vector>
@ -34,13 +35,12 @@ enum Key: uint16_t {
class Machine:
public CRTMachine::Machine,
public ConfigurationTarget::Machine {
public ConfigurationTarget::Machine,
public KeyboardMachine::Machine {
public:
static Machine *ZX8081();
virtual void set_rom(ROMType type, std::vector<uint8_t> data) = 0;
virtual void set_key_state(uint16_t key, bool isPressed) = 0;
virtual void clear_all_keys() = 0;
virtual void set_use_fast_tape_hack(bool activate) = 0;
virtual void set_tape_is_playing(bool is_playing) = 0;