mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Win32 keyname implementation
This commit is contained in:
parent
9fdc2abb4e
commit
69139c162a
1 changed files with 11 additions and 0 deletions
|
|
@ -80,7 +80,17 @@ int keycode::NUM_LOCK = GLFW_KEY_NUM_LOCK;
|
|||
int keycode::LEFT_BRACKET = GLFW_KEY_LEFT_BRACKET;
|
||||
int keycode::RIGHT_BRACKET = GLFW_KEY_RIGHT_BRACKET;
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif // _WIN32
|
||||
|
||||
const char* keycode::name(int code) {
|
||||
#ifdef _WIN32
|
||||
char name[64];
|
||||
int result = GetKeyNameTextA(glfwGetKeyScancode(code) << 16, name, 64);
|
||||
if (result == NULL) return "Unknown";
|
||||
return name;
|
||||
#else
|
||||
const char* name = glfwGetKeyName(code, glfwGetKeyScancode(code));
|
||||
if (name == nullptr) {
|
||||
switch (code) {
|
||||
|
|
@ -129,6 +139,7 @@ const char* keycode::name(int code) {
|
|||
}
|
||||
}
|
||||
return name;
|
||||
#endif // _WIN32
|
||||
}
|
||||
|
||||
int mousecode::BUTTON_1 = GLFW_MOUSE_BUTTON_1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue