29 #define SCREEN_WIDTH GRAPH_WIDTH 30 #define SCREEN_HEIGHT GRAPH_HEIGHT 31 #define CONSOLE_WIDTH (SCREEN_WIDTH/fnt_width) 32 #define CONSOLE_HEIGHT (SCREEN_HEIGHT/fnt_height) 34 static short screen_width;
35 static short screen_height;
36 static short console_width;
37 static short console_height;
39 static short fnt_width;
40 static short fnt_height;
44 static unsigned char esc;
48 #ifdef GSC_FONTS_ENABLE_KANJI 49 #ifdef GSC_FONTS_ENABLE_FONT_JISKAN16 50 static const char def_font[] =
"jiskan16";
52 static const char def_font[] =
"8x16";
55 static const char def_font[] =
"8x16";
58 extern const struct st_device grconsole_device;
60 static int grconsole_register(
struct st_device *dev,
char *param)
66 char *fname = (
char *)def_font;
75 SYSERR_PRINT(
"Cannot set font \"%s\".\n", fname);
83 console_width = screen_width/fnt_width;
84 console_height = screen_height/fnt_height;
87 screct.
right = screen_width;
89 screct.
bottom = screen_height;
92 blrect.
right = screen_width;
93 blrect.
top = fnt_height * (console_height - 1);
94 blrect.
bottom = fnt_height * console_height;
96 tkprintf(
"Console \"%s\" %dx%d, font \"%s\"\n", grconsole_device.
name,
97 console_width, console_height, fname);
102 static void draw_cursor(
unsigned char on)
106 rect.
left = cur_x * fnt_width;
107 rect.right = (cur_x + 1) * fnt_width;
108 rect.top = cur_y * fnt_height;
109 rect.bottom = (cur_y + 1) * fnt_height;
120 static void next_line(
void)
123 if(cur_y >= console_height) {
124 cur_y = (console_height - 1);
133 static void draw_ch(
unsigned short x,
unsigned short y,
unsigned short ch)
135 draw_char(x * fnt_width, y * fnt_height, ch);
138 static void put_char(
unsigned char ch)
156 cur_x = (console_width - 1);
165 if(cur_x >= (console_width-1)) {
169 draw_ch(cur_x, cur_y, ch);
171 if(cur_x >= console_width) {
184 static int grconsole_open(
struct st_device *dev)
191 static int grconsole_ioctl(
struct st_device *dev,
unsigned int com,
unsigned int arg,
void *param)
195 grconsole_register(dev, (
char *)param);
202 static int grconsole_putc(
struct st_device *dev,
unsigned char data)
226 for(i=cur_x; i<console_width; i++) {
227 draw_ch(i, cur_y,
' ');
242 static int grconsole_seek(
struct st_device *dev,
int offset,
int whence)
258 cur_x = grc_addr % console_width;
259 cur_y = grc_addr / console_height;
264 const struct st_device grconsole_device = {
266 .explan =
"Graphic console",
267 .register_dev = grconsole_register,
268 .open = grconsole_open,
269 .ioctl = grconsole_ioctl,
270 .putc = grconsole_putc,
271 .seek = grconsole_seek,
void clear_clip_rect(void)
クリッピングエリアを無効にする
#define GRP_DRAWMODE_NORMAL
Draw the foreground with fore color. Draw the background with back color.
#define GRP_DRAWMODE_REVERSE
Draw the foreground with back color. Draw the background with fore color.
void get_screen_info(short *width, short *height)
スクリーンのサイズ情報を取得する
unsigned short height
1文字の高さ(ピクセル数)
int tkprintf(const char *fmt,...)
非タスクコンテキスト実行用メッセージ出力
void scroll_rect_v(struct st_rect *rect, short pixcel)
矩形範囲を縦方向にスクロールする
struct st_fontset * set_font_by_name(char *name)
カレントフォントセットをフォント名で設定する
void draw_fill_rect(struct st_rect *rect)
塗りつぶした矩形を描画する
void set_draw_mode(unsigned char mode)
描画モードを設定する
unsigned short draw_char(short x, short y, ushort ch)
文字を描画する
struct st_font * font
半角フォントデータポインタ
unsigned short width
1文字の幅(ピクセル数)
#define SEEK_END
ファイルサイズに加算
char name[MAX_DEVNAMELRN]
デバイス名文字列