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:
@@ -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"
|
||||
@@ -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 */
|
||||
Reference in New Issue
Block a user