1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-26 19:17:52 +00:00

Introduces a joystick analogue to the shared keyboard interface, and implements it for the Vic-20.

This commit is contained in:
Thomas Harte
2017-10-14 22:36:31 -04:00
parent 3a05ce36de
commit ee179aa7bd
7 changed files with 132 additions and 81 deletions
+9
View File
@@ -0,0 +1,9 @@
//
// Joystick.cpp
// Clock Signal
//
// Created by Thomas Harte on 14/10/2017.
// Copyright © 2017 Thomas Harte. All rights reserved.
//
#include "Joystick.hpp"
+35
View File
@@ -0,0 +1,35 @@
//
// Joystick.hpp
// Clock Signal
//
// Created by Thomas Harte on 14/10/2017.
// Copyright © 2017 Thomas Harte. All rights reserved.
//
#ifndef Joystick_hpp
#define Joystick_hpp
#include <vector>
namespace Inputs {
/*!
Provides an intermediate idealised model of a simple joystick, allowing a host
machine to toggle states, while an interested party either observes or polls.
*/
class Joystick {
public:
virtual ~Joystick() {}
enum class DigitalInput {
Up, Down, Left, Right, Fire
};
// Host interface.
virtual void set_digital_input(DigitalInput digital_input, bool is_active) = 0;
virtual void reset_all_inputs() = 0;
};
}
#endif /* Joystick_hpp */