mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-22 17:25:46 +00:00
GC Adapter Implementation
This commit is contained in:
parent
f98bf1025f
commit
0248614add
18 changed files with 1156 additions and 158 deletions
|
@ -13,7 +13,8 @@ namespace InputCommon {
|
|||
class KeyButton final : public Input::ButtonDevice {
|
||||
public:
|
||||
explicit KeyButton(std::shared_ptr<KeyButtonList> key_button_list_)
|
||||
: key_button_list(std::move(key_button_list_)) {}
|
||||
: key_button_list(std::move(key_button_list_)) {
|
||||
}
|
||||
|
||||
~KeyButton() override;
|
||||
|
||||
|
@ -49,8 +50,10 @@ public:
|
|||
void ChangeKeyStatus(int key_code, bool pressed) {
|
||||
std::lock_guard guard{mutex};
|
||||
for (const KeyButtonPair& pair : list) {
|
||||
if (pair.key_code == key_code)
|
||||
if (pair.key_code == key_code) {
|
||||
pair.key_button->status.store(pressed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,7 +69,9 @@ private:
|
|||
std::list<KeyButtonPair> list;
|
||||
};
|
||||
|
||||
Keyboard::Keyboard() : key_button_list{std::make_shared<KeyButtonList>()} {}
|
||||
Keyboard::Keyboard()
|
||||
: key_button_list{std::make_shared<KeyButtonList>()} {
|
||||
}
|
||||
|
||||
KeyButton::~KeyButton() {
|
||||
key_button_list->RemoveKeyButton(this);
|
||||
|
@ -76,7 +81,7 @@ std::unique_ptr<Input::ButtonDevice> Keyboard::Create(const Common::ParamPackage
|
|||
int key_code = params.Get("code", 0);
|
||||
std::unique_ptr<KeyButton> button = std::make_unique<KeyButton>(key_button_list);
|
||||
key_button_list->AddKeyButton(key_code, button.get());
|
||||
return button;
|
||||
return std::move(button);
|
||||
}
|
||||
|
||||
void Keyboard::PressKey(int key_code) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue