Skip to content

Commit

Permalink
Merge pull request #4 from developer239/feat/support-f-keys
Browse files Browse the repository at this point in the history
feat: support F keys
  • Loading branch information
developer239 authored Oct 30, 2023
2 parents 79d2eda + 9473c78 commit a208e68
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
28 changes: 26 additions & 2 deletions src/Keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,19 @@ std::map<Keyboard::SpecialKey, KeyCode> Keyboard::specialKeyToVirtualKeyMap = {
{Keyboard::ALT, kVK_Option},
{Keyboard::CONTROL, kVK_Control},
{Keyboard::SHIFT, kVK_Shift},
{Keyboard::CAPSLOCK, kVK_CapsLock}};
{Keyboard::CAPSLOCK, kVK_CapsLock},
{Keyboard::F1, kVK_F1},
{Keyboard::F2, kVK_F2},
{Keyboard::F3, kVK_F3},
{Keyboard::F4, kVK_F4},
{Keyboard::F5, kVK_F5},
{Keyboard::F6, kVK_F6},
{Keyboard::F7, kVK_F7},
{Keyboard::F8, kVK_F8},
{Keyboard::F9, kVK_F9},
{Keyboard::F10, kVK_F10},
{Keyboard::F11, kVK_F11},
{Keyboard::F12, kVK_F12}};
#endif

char Keyboard::VirtualKeyToAscii(KeyCode virtualKey) {
Expand Down Expand Up @@ -342,7 +354,19 @@ std::map<Keyboard::SpecialKey, KeyCode> Keyboard::specialKeyToVirtualKeyMap = {
{Keyboard::ALT, VK_MENU},
{Keyboard::CONTROL, VK_CONTROL},
{Keyboard::SHIFT, VK_SHIFT},
{Keyboard::CAPSLOCK, VK_CAPITAL}};
{Keyboard::CAPSLOCK, VK_CAPITAL},
{Keyboard::F1, VK_F1},
{Keyboard::F2, VK_F2},
{Keyboard::F3, VK_F3},
{Keyboard::F4, VK_F4},
{Keyboard::F5, VK_F5},
{Keyboard::F6, VK_F6},
{Keyboard::F7, VK_F7},
{Keyboard::F8, VK_F8},
{Keyboard::F9, VK_F9},
{Keyboard::F10, VK_F10},
{Keyboard::F11, VK_F11},
{Keyboard::F12, VK_F12}};
#endif

#ifdef __APPLE__
Expand Down
14 changes: 13 additions & 1 deletion src/Keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,19 @@ class Keyboard {
ALT,
CONTROL,
SHIFT,
CAPSLOCK
CAPSLOCK,
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
F11,
F12
};

static const char INVALID_ASCII;
Expand Down

0 comments on commit a208e68

Please sign in to comment.