提交 54e58f47 编写于 作者: 指向BIOS的野指针's avatar 指向BIOS的野指针

finish guilog

上级 d5a92de9
......@@ -36,7 +36,7 @@ namespace bwl
cursor_move = true;
cursor_flash = new std::thread(cursorFlasher); //开启光标刷新线程
bwl::log("init succeeded");
putString("!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\nHello,World!");
clear();
}
void clear()
......@@ -131,14 +131,53 @@ namespace bwl
void putChar(char c)
{
cursor_move = false; //停止光标线程刷新
if (c == '\n') //换行符检测
switch (c) //检测特殊字符
{
case '\n': //换行
cursor[0] = 0;
cursor[1]++;
cursor_move = true;
return;
goto putChar_return;
case '\t': //水平制表符
if ((cursor[0] + 8) * 8 > size[0])
{
cursor[0] = 0;
cursor[1]++;
}
cursor[0] += 8;
cursor[0] -= cursor[0] % 8;
goto putChar_return;
case '\v': //垂直制表符
cursor[1]++;
if ((1 + cursor[1]) * 16 > size[1]) //检测页尾
{
cursor[0] = 0;
cursor[1] = 0;
clear();
}
goto putChar_return;
case '\r': //回车
cursor[0] = 0;
goto putChar_return;
case '\b': //退格
cursor[0]--;
if (cursor[0] < 0)
cursor[0] = 0;
paintChar(cursor[0] * 8, cursor[1] * 16, c);
goto putChar_return;
case '\f': //换页
clear();
cursor[0] = 0;
cursor[1] = 0;
goto putChar_return;
default:
break;
}
bwl::log(std::string("pos:") + std::to_string(cursor[0]) + "," + std::to_string(cursor[1]));
paintChar(cursor[0] * 8, cursor[1] * 16, c); //将字符绘制出来
cursor[0]++; //光标后移
......@@ -153,6 +192,7 @@ namespace bwl
cursor[1] = 0;
clear();
}
putChar_return:
cursor_move = true; //继续光标刷新
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册