/trunk/uspace/app/tetris/scores.c |
---|
55,8 → 55,9 |
#include <stdio.h> |
/* #include <stdlib.h> */ |
#include <string.h> |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <io/console.h> |
#include <io/keycode.h> |
#include <vfs/vfs.h> |
#include <stdlib.h> |
/* #include <time.h> */ |
/* #include <term.h> */ |
127,7 → 128,7 |
{ |
int i,j; |
size_t off; |
kbd_event_t ev; |
console_event_t ev; |
clear_screen(); |
moveto(10 , 10); |
141,10 → 142,10 |
while (1) { |
fflush(stdout); |
if (kbd_get_event(&ev) != EOK) |
if (!console_get_event(fphone(stdin), &ev)) |
exit(1); |
if (ev.type == KE_RELEASE) |
if (ev.type == KEY_RELEASE) |
continue; |
if (ev.key == KC_ENTER || ev.key == KC_NENTER) |
/trunk/uspace/app/tetris/input.c |
---|
57,9 → 57,9 |
#include "tetris.h" |
#include <async.h> |
#include <vfs/vfs.h> |
#include <io/console.h> |
#include <ipc/console.h> |
#include <console.h> |
#include <kbd/kbd.h> |
/* return true iff the given timeval is positive */ |
#define TV_POS(tv) \ |
98,7 → 98,6 |
struct timeval starttv, endtv, *s; |
static ipc_call_t charcall; |
ipcarg_t rc; |
int cons_phone; |
/* |
* Someday, select() will do this for us. |
115,11 → 114,10 |
if (!lastchar) { |
again: |
if (!getchar_inprog) { |
cons_phone = console_open(true); |
getchar_inprog = async_send_2(cons_phone, |
CONSOLE_GETKEY, 0, 0, &charcall); |
getchar_inprog = async_send_0(fphone(stdin), |
CONSOLE_GET_EVENT, &charcall); |
} |
if (!s) |
if (!s) |
async_wait_for(getchar_inprog, &rc); |
else if (async_wait_timeout(getchar_inprog, &rc, s->tv_usec) == ETIMEOUT) { |
tvp->tv_sec = 0; |
130,7 → 128,7 |
if (rc) { |
stop("end of file, help"); |
} |
if (IPC_GET_ARG1(charcall) == KE_RELEASE) |
if (IPC_GET_ARG1(charcall) == KEY_RELEASE) |
goto again; |
lastchar = IPC_GET_ARG4(charcall); |
/trunk/uspace/app/tetris/screen.c |
---|
50,12 → 50,11 |
#include <stdlib.h> |
#include <string.h> |
#include <unistd.h> |
#include <console.h> |
#include <vfs/vfs.h> |
#include <async.h> |
#include "screen.h" |
#include "tetris.h" |
#include <ipc/console.h> |
#include <io/console.h> |
static cell curscreen[B_SIZE]; /* 1 => standout (or otherwise marked) */ |
static int curscore; |
64,7 → 63,7 |
/* |
* putstr() is for unpadded strings (either as in termcap(5) or |
* simply literal strings); |
* simply literal strings); |
*/ |
static inline void putstr(char *s) |
{ |
74,17 → 73,17 |
static void start_standout(void) |
{ |
console_set_rgb_color(0xf0f0f0, 0); |
console_set_rgb_color(fphone(stdout), 0xf0f0f0, 0); |
} |
static void resume_normal(void) |
{ |
console_set_rgb_color(0, 0xf0f0f0); |
console_set_rgb_color(fphone(stdout), 0, 0xf0f0f0); |
} |
void clear_screen(void) |
{ |
console_clear(); |
console_clear(fphone(stdout)); |
moveto(0, 0); |
} |
96,7 → 95,7 |
{ |
resume_normal(); |
console_clear(); |
console_clear(fphone(stdout)); |
curscore = -1; |
memset((char *)curscreen, 0, sizeof(curscreen)); |
} |
107,7 → 106,7 |
void |
scr_init(void) |
{ |
console_cursor_visibility(0); |
console_cursor_visibility(fphone(stdout), 0); |
resume_normal(); |
scr_clear(); |
} |
114,7 → 113,7 |
void moveto(int r, int c) |
{ |
console_goto(r, c); |
console_goto(fphone(stdout), c, r); |
} |
winsize_t winsize; |
121,7 → 120,7 |
static int get_display_size(winsize_t *ws) |
{ |
return console_get_size(&ws->ws_row, &ws->ws_col); |
return console_get_size(fphone(stdout), &ws->ws_col, &ws->ws_row); |
} |
/* |
/trunk/uspace/app/tetris/screen.h |
---|
46,11 → 46,12 |
*/ |
#define putpad(s) tputs(s, 1, put) |
#include <sys/types.h> |
#include <async.h> |
typedef struct { |
int ws_row; |
int ws_col; |
ipcarg_t ws_row; |
ipcarg_t ws_col; |
} winsize_t; |
extern winsize_t winsize; |