4coder/4ed_keyboard.cpp

36 lines
648 B
C++
Raw Normal View History

2015-09-28 23:34:55 +00:00
/*
* Mr. 4th Dimention - Allen Webster
*
2015-12-01 02:51:53 +00:00
* 16.11.2014
2015-09-28 23:34:55 +00:00
*
2015-11-16 16:15:45 +00:00
* Win32-US Keyboard layer for 4coder
2015-09-28 23:34:55 +00:00
*
*/
// TOP
2016-01-06 15:39:15 +00:00
globalvar u8 keycode_lookup_table[255];
2015-09-28 23:34:55 +00:00
internal void
2015-12-01 02:51:53 +00:00
set_dynamic_key_names(Key_Codes *codes){
2016-01-06 15:39:15 +00:00
u8 code = 1;
u8 *codes_array = (u8*)codes;
2015-12-01 02:51:53 +00:00
for (i32 i = 0; i < sizeof(*codes)/sizeof(codes->up);){
2015-09-28 23:34:55 +00:00
switch (code){
case '\n': code++; break;
case '\t': code++; break;
case 0x20: code = 0x7F; break;
2016-01-06 15:39:15 +00:00
default:
codes_array[i++] = code++;
2015-09-28 23:34:55 +00:00
}
}
}
2016-01-06 15:39:15 +00:00
inline u8
2015-12-01 02:51:53 +00:00
keycode_lookup(u8 system_code){
return keycode_lookup_table[system_code];
2015-09-28 23:34:55 +00:00
}
// BOTTOM
2015-11-16 16:15:45 +00:00