Issue 2 #3
+2
-29
@@ -3,15 +3,6 @@
|
|||||||
#include <graphics/draw.h>
|
#include <graphics/draw.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
|
||||||
static unsigned int pf_x = 0;
|
|
||||||
static unsigned int pf_y = 1;
|
|
||||||
|
|
||||||
void pf_reset_position(void) {
|
|
||||||
// 其实应该还要清一下屏,后面思考一个安全的做法
|
|
||||||
pf_x = 0;
|
|
||||||
pf_y = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void pf_print_char(char c, unsigned int basex, unsigned int basey, EFI_GRAPHICS_OUTPUT_BLT_PIXEL color) {
|
void pf_print_char(char c, unsigned int basex, unsigned int basey, EFI_GRAPHICS_OUTPUT_BLT_PIXEL color) {
|
||||||
for (unsigned int y = 0; y < 16; y++) {
|
for (unsigned int y = 0; y < 16; y++) {
|
||||||
unsigned char data = hankaku_pixels[c][y];
|
unsigned char data = hankaku_pixels[c][y];
|
||||||
@@ -31,27 +22,9 @@ void pf_print_char(char c, unsigned int basex, unsigned int basey, EFI_GRAPHICS_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pf_print(const char* text, EFI_GRAPHICS_OUTPUT_BLT_PIXEL color) {
|
void pf_print(const char* text, unsigned int basex, unsigned int basey, EFI_GRAPHICS_OUTPUT_BLT_PIXEL color) {
|
||||||
for (unsigned int i = 0; i < strlen(text); i++) {
|
for (unsigned int i = 0; i < strlen(text); i++) {
|
||||||
char c = text[i];
|
char c = text[i];
|
||||||
if (c == '\n') {
|
pf_print_char(c, basex + i * 8, basey, color); // 只要 字数 * 8 + basex 不爆hr就没事
|
||||||
pf_x = 0;
|
|
||||||
pf_y++;
|
|
||||||
if ((pf_y - 1) * 16 >= g_gfx.vr) {
|
|
||||||
gfx_clear();
|
|
||||||
pf_y = 1;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (pf_x * 9 + 9 > g_gfx.hr) {
|
|
||||||
pf_x = 0;
|
|
||||||
pf_y++;
|
|
||||||
if ((pf_y - 1) * 16 >= g_gfx.vr) {
|
|
||||||
gfx_clear();
|
|
||||||
pf_y = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pf_print_char(c, pf_x * 9, (pf_y - 1) * 16, color);
|
|
||||||
pf_x++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,5 +4,4 @@
|
|||||||
|
|
||||||
void pf_print_char(char c, unsigned int basex, unsigned int basey,
|
void pf_print_char(char c, unsigned int basex, unsigned int basey,
|
||||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL color = {255, 255, 255, 255}); // Pixel Font 打印字符
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL color = {255, 255, 255, 255}); // Pixel Font 打印字符
|
||||||
void pf_print(const char* text, EFI_GRAPHICS_OUTPUT_BLT_PIXEL color = {255, 255, 255, 255}); // Pixel Font 打印string
|
void pf_print(const char* text, unsigned int basex, unsigned int basey, EFI_GRAPHICS_OUTPUT_BLT_PIXEL color = {255, 255, 255, 255}); // Pixel Font 打印string
|
||||||
void pf_reset_position(void); // 重设Pixel Font Cursor位置
|
|
||||||
+1
-1
@@ -130,7 +130,7 @@ extern "C" void kernel_main() {
|
|||||||
fs_list();
|
fs_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
pf_print("Welcome to Sylva OS!\n");
|
// pf_print("Welcome to Sylva OS!\n");
|
||||||
serial_write(" Kernel prepared well.\n");
|
serial_write(" Kernel prepared well.\n");
|
||||||
|
|
||||||
// --- Interrupt infrastructure ---
|
// --- Interrupt infrastructure ---
|
||||||
|
|||||||
Reference in New Issue
Block a user