Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3767 → Rev 3768

/trunk/uspace/app/tetris/screen.c
50,7 → 50,6
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <io/stream.h>
#include <console.h>
 
#include <async.h>
73,9 → 72,6
putchar(*(s++));
}
 
static int con_phone;
 
 
static void start_standout(void)
{
console_set_rgb_color(0xf0f0f0, 0);
88,7 → 84,7
 
void clear_screen(void)
{
async_msg_0(con_phone, CONSOLE_CLEAR);
console_clear();
moveto(0, 0);
}
 
100,7 → 96,7
{
 
resume_normal();
async_msg_0(con_phone, CONSOLE_CLEAR);
console_clear();
curscore = -1;
memset((char *)curscreen, 0, sizeof(curscreen));
}
111,8 → 107,7
void
scr_init(void)
{
con_phone = get_cons_phone();
async_msg_1(con_phone, CONSOLE_CURSOR_VISIBILITY, 0);
console_cursor_visibility(0);
resume_normal();
scr_clear();
}
119,12 → 114,12
 
void moveto(int r, int c)
{
async_msg_2(con_phone, CONSOLE_GOTO, r, c);
console_goto(r, c);
}
 
static void fflush(void)
{
async_msg_0(con_phone, CONSOLE_FLUSH);
console_flush();
}
 
winsize_t winsize;
131,8 → 126,7
 
static int get_display_size(winsize_t *ws)
{
return async_req_0_2(con_phone, CONSOLE_GETSIZE, &ws->ws_row,
&ws->ws_col);
return console_get_size(&ws->ws_row, &ws->ws_col);
}
 
/*
/trunk/uspace/app/tetris/screen.h
49,8 → 49,8
#include <async.h>
 
typedef struct {
ipcarg_t ws_row;
ipcarg_t ws_col;
int ws_row;
int ws_col;
} winsize_t;
 
extern winsize_t winsize;
/trunk/uspace/lib/libc/include/console.h
38,9 → 38,14
#include <console/style.h>
#include <console/color.h>
 
extern void console_clear(void);
extern void console_goto(int, int);
extern void console_flush(void);
extern int console_get_size(int *, int *);
extern void console_set_style(int);
extern void console_set_color(int, int, int);
extern void console_set_rgb_color(int, int);
extern void console_cursor_visibility(int);
 
#endif
/trunk/uspace/lib/libc/generic/console.c
37,10 → 37,41
#include <ipc/console.h>
#include <console.h>
 
void console_clear(void)
{
int cons_phone = get_cons_phone();
async_msg_0(cons_phone, CONSOLE_CLEAR);
}
 
void console_goto(int row, int col)
{
int cons_phone = get_cons_phone();
async_msg_2(cons_phone, CONSOLE_GOTO, row, col);
}
 
void console_flush(void)
{
int cons_phone = get_cons_phone();
async_msg_0(cons_phone, CONSOLE_FLUSH);
}
 
int console_get_size(int *rows, int *cols)
{
int cons_phone = get_cons_phone();
ipcarg_t r, c;
int rc;
 
rc = async_req_0_2(cons_phone, CONSOLE_GETSIZE, &r, &c);
 
*rows = (int) r;
*cols = (int) c;
 
return rc;
}
 
void console_set_style(int style)
{
int cons_phone = get_cons_phone();
 
async_msg_1(cons_phone, CONSOLE_SET_STYLE, style);
}
 
47,7 → 78,6
void console_set_color(int fg_color, int bg_color, int flags)
{
int cons_phone = get_cons_phone();
 
async_msg_3(cons_phone, CONSOLE_SET_COLOR, fg_color, bg_color, flags);
}
 
54,9 → 84,14
void console_set_rgb_color(int fg_color, int bg_color)
{
int cons_phone = get_cons_phone();
 
async_msg_2(cons_phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color);
}
 
void console_cursor_visibility(int show)
{
int cons_phone = get_cons_phone();
async_msg_1(cons_phone, CONSOLE_CURSOR_VISIBILITY, show != 0);
}
 
/** @}
*/