Changeset 7122bc7 in mainline
- Timestamp:
- 2009-01-01T13:58:05Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fb69f39
- Parents:
- 9805cde
- Location:
- uspace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tetris/screen.c
r9805cde r7122bc7 51 51 #include <string.h> 52 52 #include <unistd.h> 53 #include <io/stream.h>54 53 #include <console.h> 55 54 … … 74 73 } 75 74 76 static int con_phone;77 78 79 75 static void start_standout(void) 80 76 { … … 89 85 void clear_screen(void) 90 86 { 91 async_msg_0(con_phone, CONSOLE_CLEAR);87 console_clear(); 92 88 moveto(0, 0); 93 89 } … … 101 97 102 98 resume_normal(); 103 async_msg_0(con_phone, CONSOLE_CLEAR);99 console_clear(); 104 100 curscore = -1; 105 101 memset((char *)curscreen, 0, sizeof(curscreen)); … … 112 108 scr_init(void) 113 109 { 114 con_phone = get_cons_phone(); 115 async_msg_1(con_phone, CONSOLE_CURSOR_VISIBILITY, 0); 110 console_cursor_visibility(0); 116 111 resume_normal(); 117 112 scr_clear(); … … 120 115 void moveto(int r, int c) 121 116 { 122 async_msg_2(con_phone, CONSOLE_GOTO,r, c);117 console_goto(r, c); 123 118 } 124 119 125 120 static void fflush(void) 126 121 { 127 async_msg_0(con_phone, CONSOLE_FLUSH);122 console_flush(); 128 123 } 129 124 … … 132 127 static int get_display_size(winsize_t *ws) 133 128 { 134 return async_req_0_2(con_phone, CONSOLE_GETSIZE, &ws->ws_row, 135 &ws->ws_col); 129 return console_get_size(&ws->ws_row, &ws->ws_col); 136 130 } 137 131 -
uspace/app/tetris/screen.h
r9805cde r7122bc7 50 50 51 51 typedef struct { 52 i pcarg_t ws_row;53 i pcarg_t ws_col;52 int ws_row; 53 int ws_col; 54 54 } winsize_t; 55 55 -
uspace/lib/libc/generic/console.c
r9805cde r7122bc7 38 38 #include <console.h> 39 39 40 void console_clear(void) 41 { 42 int cons_phone = get_cons_phone(); 43 async_msg_0(cons_phone, CONSOLE_CLEAR); 44 } 45 46 void console_goto(int row, int col) 47 { 48 int cons_phone = get_cons_phone(); 49 async_msg_2(cons_phone, CONSOLE_GOTO, row, col); 50 } 51 52 void console_flush(void) 53 { 54 int cons_phone = get_cons_phone(); 55 async_msg_0(cons_phone, CONSOLE_FLUSH); 56 } 57 58 int console_get_size(int *rows, int *cols) 59 { 60 int cons_phone = get_cons_phone(); 61 ipcarg_t r, c; 62 int rc; 63 64 rc = async_req_0_2(cons_phone, CONSOLE_GETSIZE, &r, &c); 65 66 *rows = (int) r; 67 *cols = (int) c; 68 69 return rc; 70 } 71 40 72 void console_set_style(int style) 41 73 { 42 74 int cons_phone = get_cons_phone(); 43 44 75 async_msg_1(cons_phone, CONSOLE_SET_STYLE, style); 45 76 } … … 48 79 { 49 80 int cons_phone = get_cons_phone(); 50 51 81 async_msg_3(cons_phone, CONSOLE_SET_COLOR, fg_color, bg_color, flags); 52 82 } … … 55 85 { 56 86 int cons_phone = get_cons_phone(); 87 async_msg_2(cons_phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color); 88 } 57 89 58 async_msg_2(cons_phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color); 90 void console_cursor_visibility(int show) 91 { 92 int cons_phone = get_cons_phone(); 93 async_msg_1(cons_phone, CONSOLE_CURSOR_VISIBILITY, show != 0); 59 94 } 60 95 -
uspace/lib/libc/include/console.h
r9805cde r7122bc7 39 39 #include <console/color.h> 40 40 41 extern void console_clear(void); 42 extern void console_goto(int, int); 43 extern void console_flush(void); 44 extern int console_get_size(int *, int *); 41 45 extern void console_set_style(int); 42 46 extern void console_set_color(int, int, int); 43 47 extern void console_set_rgb_color(int, int); 48 extern void console_cursor_visibility(int); 44 49 45 50 #endif
Note:
See TracChangeset
for help on using the changeset viewer.