键盘加入 Ctrl 按键监听
This commit is contained in:
parent
048f85123d
commit
0702be2565
@ -102,12 +102,18 @@ int handle_keyboard_input(){
|
||||
int release = key & 0xb10000000;
|
||||
char c = key_status->is_shift ? shift_keyboard_map[(unsigned char )key] : keyboard_map[(unsigned char )key];
|
||||
|
||||
|
||||
if(!release) {
|
||||
if(c == -1) {
|
||||
key_status->is_shift = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(key == 29){
|
||||
key_status->is_ctrl = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(c == 0) return 0;
|
||||
|
||||
queue_push(key_char_queue,(char)c);
|
||||
@ -115,6 +121,11 @@ int handle_keyboard_input(){
|
||||
if(c == -1){
|
||||
key_status->is_shift = 0;
|
||||
}
|
||||
|
||||
if(key == 29){
|
||||
key_status->is_ctrl = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
typedef struct {
|
||||
int is_shift;
|
||||
int is_ctrl;
|
||||
int is_esc;
|
||||
}KEY_STATUS;
|
||||
|
||||
typedef struct {
|
||||
|
Loading…
Reference in New Issue
Block a user