diff --git a/CMakeLists.txt b/CMakeLists.txt index d48c4a8..275edb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,8 @@ add_custom_target( add_library(${lib_name} libplip/Plip.cpp + libplip/PlipInput.cpp + libplip/PlipInputDefinition.cpp ) add_dependencies(${lib_name} GENERATE_LIB_VERSION_HEADER) diff --git a/libplip/PlipInput.cpp b/libplip/PlipInput.cpp new file mode 100644 index 0000000..ee73fed --- /dev/null +++ b/libplip/PlipInput.cpp @@ -0,0 +1,20 @@ +/* PlipInput.cpp + * + * Provides an interface between the emulation core and the frontend. + */ + +#include "PlipInput.h" + +namespace Plip { + void PlipInput::AddInput(int id, const PlipInputDefinition& input) { + m_coreInput.insert(std::pair(id, input)); + } + + void PlipInput::AddInput(std::map inputList) { + m_coreInput.insert(inputList.begin(), inputList.end()); + } + + void PlipInput::ClearInput() { + m_coreInput.clear(); + } +} diff --git a/libplip/PlipInput.h b/libplip/PlipInput.h new file mode 100644 index 0000000..a951aa0 --- /dev/null +++ b/libplip/PlipInput.h @@ -0,0 +1,26 @@ +/* PlipInput.h + * + * Provides an interface between the emulation core and the frontend. + */ + +#pragma once + +#include +#include + +#include "PlipInputDefinition.h" + +namespace Plip { + class PlipInput { + public: + void AddInput(int id, const PlipInputDefinition &input); + void AddInput(std::map inputList); + void ClearInput(); + + protected: + PlipInput() = default; + + private: + std::map m_coreInput; + }; +} diff --git a/libplip/PlipInputDefinition.cpp b/libplip/PlipInputDefinition.cpp new file mode 100644 index 0000000..686d7ca --- /dev/null +++ b/libplip/PlipInputDefinition.cpp @@ -0,0 +1,21 @@ +/* PlipInputDefinition.cpp + * + * Allows the core to define an input for the frontend to handle. + */ + +#include "PlipInputDefinition.h" + +namespace Plip { + PlipInputDefinition::PlipInputDefinition(PlipInputType type, const std::string &description) { + m_type = type; + m_description = description; + } + + std::string PlipInputDefinition::GetDescription() const { + return m_description; + } + + PlipInputType PlipInputDefinition::GetType() const { + return m_type; + } +} diff --git a/libplip/PlipInputDefinition.h b/libplip/PlipInputDefinition.h new file mode 100644 index 0000000..4af879b --- /dev/null +++ b/libplip/PlipInputDefinition.h @@ -0,0 +1,32 @@ +/* PlipInputDefinition.h + * + * Allows the core to define an input for the frontend to handle. + */ + +#pragma once + +#include + +namespace Plip { + union PlipInputData { + bool digital = false; + }; + + enum class PlipInputType { + Digital + }; + + class PlipInputDefinition { + public: + PlipInputDefinition(PlipInputType type, const std::string &description); + + std::string GetDescription() const; + PlipInputType GetType() const; + + PlipInputData data; + + private: + PlipInputType m_type; + std::string m_description; + }; +} diff --git a/libplip/PlipVersion.h b/libplip/PlipVersion.h index 183e8f7..3e71a39 100644 --- a/libplip/PlipVersion.h +++ b/libplip/PlipVersion.h @@ -5,5 +5,5 @@ #define GIT_FOUND #define GIT_BRANCH "master" -#define GIT_REVISION "a6b8d9f" +#define GIT_REVISION "e43f14f" /* #undef GIT_TAG */ diff --git a/libplip/PlipVideo.h b/libplip/PlipVideo.h index b4cc122..14f6328 100644 --- a/libplip/PlipVideo.h +++ b/libplip/PlipVideo.h @@ -31,6 +31,5 @@ namespace Plip { protected: PlipVideo() = default; - ~PlipVideo() = default; }; }