/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; |
/trunk/uspace/app/klog/klog.c |
---|
40,25 → 40,24 |
#include <ipc/services.h> |
#include <as.h> |
#include <sysinfo.h> |
#include <io/stream.h> |
#include <console.h> |
#include <event.h> |
#include <errno.h> |
#include <io/klog.h> |
#define NAME "klog" |
#define NAME "klog" |
/* Pointer to klog area */ |
static wchar_t *klog; |
static count_t klog_length; |
static size_t klog_length; |
static void interrupt_received(ipc_callid_t callid, ipc_call_t *call) |
{ |
async_serialize_start(); |
count_t klog_start = (count_t) IPC_GET_ARG1(*call); |
count_t klog_len = (count_t) IPC_GET_ARG2(*call); |
count_t klog_stored = (count_t) IPC_GET_ARG3(*call); |
count_t i; |
size_t klog_start = (size_t) IPC_GET_ARG1(*call); |
size_t klog_len = (size_t) IPC_GET_ARG2(*call); |
size_t klog_stored = (size_t) IPC_GET_ARG3(*call); |
size_t i; |
for (i = klog_len - klog_stored; i < klog_len; i++) |
putchar(klog[(klog_start + i) % klog_length]); |
68,9 → 67,7 |
int main(int argc, char *argv[]) |
{ |
console_wait(); |
count_t klog_pages = sysinfo_value("klog.pages"); |
size_t klog_pages = sysinfo_value("klog.pages"); |
size_t klog_size = klog_pages * PAGE_SIZE; |
klog_length = klog_size / sizeof(wchar_t); |