Skip to content

Commit

Permalink
控制光标闪烁(1)
Browse files Browse the repository at this point in the history
  • Loading branch information
yourtion committed Apr 27, 2016
1 parent b85921c commit e3745ac
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions 18_day/bootpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,12 @@ void HariMain(void)
key_to = 1;
make_wtitle8(buf_win, sht_win->bxsize, "task_a", 0);
make_wtitle8(buf_cons, sht_cons->bxsize, "console", 1);
cursor_c = -1; /* 不显示光标 */
} else {
key_to = 0;
make_wtitle8(buf_win, sht_win->bxsize, "task_a", 1);
make_wtitle8(buf_cons, sht_cons->bxsize, "console", 0);
cursor_c = COL8_000000;
}
sheet_refresh(sht_win, 0, 0, sht_win->bxsize, 21);
sheet_refresh(sht_cons, 0, 0, sht_cons->bxsize, 21);
Expand Down Expand Up @@ -233,7 +235,9 @@ void HariMain(void)
io_out8(PORT_KEYDAT, keycmd_wait);
}
/*重新显示光标*/
boxfill8(sht_win->buf, sht_win->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43);
if (cursor_c >= 0) {
boxfill8(sht_win->buf, sht_win->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43);
}
sheet_refresh(sht_win, cursor_x, 28, cursor_x + 8, 44);
} else if (512 <= i && i <= 767) { /* 鼠标数据*/
if (mouse_decode(&mdec, i - 512) != 0) {
Expand Down Expand Up @@ -274,14 +278,20 @@ void HariMain(void)
} else if (i <= 1) { /* 光标用定时器*/
if (i != 0) {
timer_init(timer, &fifo, 0); /* 下面设定0 */
cursor_c = COL8_000000;
if (cursor_c >= 0) {
cursor_c = COL8_000000;
}
} else {
timer_init(timer, &fifo, 1); /* 下面设定1 */
cursor_c = COL8_FFFFFF;
if (cursor_c >= 0) {
cursor_c = COL8_FFFFFF;
}
}
timer_settime(timer, 50);
boxfill8(sht_win->buf, sht_win->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43);
sheet_refresh(sht_win, cursor_x, 28, cursor_x + 8, 44);
if (cursor_c >= 0) {
boxfill8(sht_win->buf, sht_win->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43);
sheet_refresh(sht_win, cursor_x, 28, cursor_x + 8, 44);
}
}
}
}
Expand Down

0 comments on commit e3745ac

Please sign in to comment.