demo: hold arrow keys back for menu

pull/344/head
nick black 4 years ago
parent b8adfe1a39
commit 2dde1d4af7
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -59,6 +59,8 @@ hud_grabbed_bg(struct ncplane* n){
struct ncmenu* menu_create(struct notcurses* nc){
struct ncmenu_item demo_items[] = {
{ .desc = "Toggle HUD", .shortcut = { .id = 'H', .ctrl = true, }, },
{ .desc = NULL, },
{ .desc = "Restart", .shortcut = { .id = 'r', .ctrl = true, }, },
};
struct ncmenu_item help_items[] = {

@ -94,10 +94,20 @@ ultramegaok_demo(void* vnc){
if(nckey_mouse_p(ni.id)){
handle_mouse(&ni);
}else{
// if this was about the menu or HUD, pass to them, and continue
if(ni.id == NCKEY_UP){
continue;
}else if(ni.id == NCKEY_DOWN){
continue;
}else if(ni.id == NCKEY_LEFT){
continue;
}else if(ni.id == NCKEY_RIGHT){
continue;
}
if(ni.id == 'q'){
interrupt_demo();
}
// go ahead and pass through the keyboard press, even if it was a 'q'
// go ahead and pass keyboard through to demo, even if it was a 'q'
// (this might cause the demo to exit immediately, as is desired)
pass_along(&ni);
}

Loading…
Cancel
Save