From 378518140711bf19a80218711a018e8fd28d3ca7 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sat, 10 Oct 2009 23:41:29 +0200 Subject: Added a nice animation for the melon logo at boot --- Source/Kernel/Core/kmain.wtf.cpp | 51 ++++++++++++++++++++++++++++++++++----- Source/Kernel/Melon.ke | Bin 165231 -> 165267 bytes 2 files changed, 45 insertions(+), 6 deletions(-) (limited to 'Source') diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index 4df2ed5..66e6a8a 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -40,6 +40,49 @@ extern "C" void kmain(multiboot_info_t* mbd, u32int magic); vt->setCursorCol(60); vt->setColor(KVT_LIGHTCOLOR); *vt << ": "; #define OK(vt) vt->setColor(KVT_FGCOLOR); *vt << "[ "; vt->setColor(KVT_OKCOLOR); *vt << "OK"; vt->setColor(KVT_FGCOLOR); *vt << " ]\n"; +u32int logoAnimation(void* p) { + SimpleVT& vt = *((SimpleVT*)p); + vt.setColor(8); + u8int *wat = new u8int[melonLogoLines * melonLogoCols]; + for (int x = 0; x < melonLogoCols; x++) { + for (int y = 0; y < melonLogoLines; y++) { + wat[x * melonLogoLines + y] = melonLogo[y][x]; + vt.putChar(y, x, " "); + } + } + vt.setColor(TXTLOGO_FGCOLOR); + u32int s = 32; + for (int i = 0; i < 255; i++) { + for (int x = 0; x < (i < melonLogoCols ? i : melonLogoCols); x++) { + for (int y = 0; y < melonLogoLines; y++) { + if (wat[x * melonLogoLines + y] != melonLogo[y][x]) { + wat[x * melonLogoLines + y]++; + if (wat[x * melonLogoLines + y] > melonLogo[y][x] && (y + x) % 2 == 1) + wat[x * melonLogoLines + y] += 2; + if (wat[x * melonLogoLines + y] >= 127) + wat[x * melonLogoLines + y] = 32; + vt.setColor(7); + vt.putChar(y, x, wat[x * melonLogoLines + y]); + } else { + vt.setColor(TXTLOGO_FGCOLOR); + vt.putChar(y, x, wat[x * melonLogoLines + y]); + } + } + } + vt.setColor(8); + if (i < melonLogoCols) { + for (int y = 0; y < melonLogoLines; y++) { + s += 102; + while (s > 127) s -= (127 - 33); + wat[(i + (y%3)) * melonLogoLines + y] = s; + vt.putChar(y, (i + (y%3)), wat[(i + (y%3)) * melonLogoLines + y]); + } + } + Task::currentThread->sleep(20); + } + return 0; +} + void kmain(multiboot_info_t* mbd, u32int magic) { DEBUG("Entering kmain."); @@ -67,11 +110,6 @@ void kmain(multiboot_info_t* mbd, u32int magic) { //Create a VT for handling the Melon bootup logo SimpleVT *melonLogoVT = new SimpleVT(melonLogoLines, melonLogoCols, TXTLOGO_FGCOLOR, TXTLOGO_BGCOLOR); - for (int i = 0; i < melonLogoLines; i++) { - for (int j = 0; j < melonLogoCols; j++) { - melonLogoVT->putChar(i, j, melonLogo[i][j]); - } - } melonLogoVT->map(1); //Create a VT for logging what kernel does @@ -101,7 +139,8 @@ void kmain(multiboot_info_t* mbd, u32int magic) { Dev::registerDevice(new Timer()); OK(kvt); PROCESSING(kvt, "Initializing multitasking..."); - Task::initialize(String((char*)mbd->cmdline), kvt); OK(kvt); + Task::initialize(String((char*)mbd->cmdline), kvt); + new Thread(logoAnimation, (void*)melonLogoVT, true); OK(kvt); PROCESSING(kvt, "Mounting first module as ramfs on root directory..."); FileSystem* fs = RamFS::mount((u8int*)mods[0].mod_start, 1024 * 1024, NULL); diff --git a/Source/Kernel/Melon.ke b/Source/Kernel/Melon.ke index 4988c1e..d511d8b 100755 Binary files a/Source/Kernel/Melon.ke and b/Source/Kernel/Melon.ke differ -- cgit v1.2.3