X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fdemo.c;h=072b6cead434c16ea9cd80f583871b5b01e459a7;hp=45b889a73487fca335410817b1c7cb0f719b3b5a;hb=77e0277af0c00dae78c7a739b2ca70cc19fd041a;hpb=77e0a84543a31aecceabc0e4b18a0d37ad92c89b diff --git a/src/demo.c b/src/demo.c index 45b889a..072b6ce 100644 --- a/src/demo.c +++ b/src/demo.c @@ -121,11 +121,11 @@ void demo_keyboard(int key, int press) switch(key) { case 27: demo_quit(); - break; + return; case 127: debug_break(); - break; + return; case '`': console_active = !console_active; @@ -135,13 +135,16 @@ void demo_keyboard(int key, int press) } else { putchar('\n'); } - break; + return; case '\b': - if(console_active && wr != rd) { - printf("\b \b"); - fflush(stdout); - wr = (wr + CBUF_SIZE - 1) & CBUF_MASK; + if(console_active) { + if(wr != rd) { + printf("\b \b"); + fflush(stdout); + wr = (wr + CBUF_SIZE - 1) & CBUF_MASK; + } + return; } break; @@ -165,6 +168,7 @@ void demo_keyboard(int key, int press) } } console_active = 0; + return; } break; @@ -175,18 +179,23 @@ void demo_keyboard(int key, int press) change_screen(9); } - if(console_active && key < 256 && isprint(key)) { - putchar(key); - fflush(stdout); - - cbuf[wr] = key; - wr = (wr + 1) & CBUF_MASK; - if(wr == rd) { /* overflow */ - rd = (rd + 1) & CBUF_MASK; + if(console_active) { + if(key < 256 && isprint(key)) { + putchar(key); + fflush(stdout); + + cbuf[wr] = key; + wr = (wr + 1) & CBUF_MASK; + if(wr == rd) { /* overflow */ + rd = (rd + 1) & CBUF_MASK; + } } + return; } break; } + + scr_keypress(key); } }