From 79553ab1fa3d707612e80dd03bf95ca65fa0c411 Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Tue, 4 Feb 2025 23:11:08 +0100 Subject: refactor file browser --- app/mac/impl/input-device-gc-keyboard.hh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/mac/impl/input-device-gc-keyboard.hh (limited to 'app/mac/impl/input-device-gc-keyboard.hh') diff --git a/app/mac/impl/input-device-gc-keyboard.hh b/app/mac/impl/input-device-gc-keyboard.hh new file mode 100644 index 0000000..c879dcc --- /dev/null +++ b/app/mac/impl/input-device-gc-keyboard.hh @@ -0,0 +1,30 @@ +#pragma once + +#import "nes/app/input/input-device-keyboard.hh" +#import "nes/app/input/input-buffer.hh" +#import + +#import + +namespace nes::app::mac +{ + /// Input device wrapping a GCKeyboard. + class input_device_gc_keyboard final : public input_device_keyboard + { + GCKeyboardInput* profile_{ nil }; + input_buffer buffer_; + + public: + explicit input_device_gc_keyboard(GCKeyboardInput* profile); + ~input_device_gc_keyboard() override; + + auto set_profile(GCKeyboardInput* profile) -> void; + + auto read_key(key const key) -> bool override { return buffer_.read_key(key); } + auto poll_event() -> input_event override { return buffer_.poll_event(); } + + private: + auto handle_key_changed(GCKeyCode key_code, BOOL pressed) -> void; + auto convert_key_code(GCKeyCode key_code) -> std::optional; + }; +} // namespace nes::app::mac \ No newline at end of file -- cgit v1.3.1