diff --git a/boredos.iso b/boredos.iso index 88e4449..57b164f 100644 Binary files a/boredos.iso and b/boredos.iso differ diff --git a/build/about.o b/build/about.o index 11ef441..7fc3c4b 100644 Binary files a/build/about.o and b/build/about.o differ diff --git a/build/boredos.elf b/build/boredos.elf index 0af98d3..ceb34e0 100755 Binary files a/build/boredos.elf and b/build/boredos.elf differ diff --git a/build/cmd.o b/build/cmd.o index d00bc9d..46239d1 100644 Binary files a/build/cmd.o and b/build/cmd.o differ diff --git a/build/control_panel.o b/build/control_panel.o index b066a78..619b3a4 100644 Binary files a/build/control_panel.o and b/build/control_panel.o differ diff --git a/build/explorer.o b/build/explorer.o index 601948c..5242bd7 100644 Binary files a/build/explorer.o and b/build/explorer.o differ diff --git a/build/graphics.o b/build/graphics.o index 8b22ee1..b482812 100644 Binary files a/build/graphics.o and b/build/graphics.o differ diff --git a/build/vm.o b/build/vm.o index a546c26..40e36e1 100644 Binary files a/build/vm.o and b/build/vm.o differ diff --git a/build/wallpaper.o b/build/wallpaper.o index c027754..3a597e0 100644 Binary files a/build/wallpaper.o and b/build/wallpaper.o differ diff --git a/build/wm.o b/build/wm.o index 790347b..c9cba77 100644 Binary files a/build/wm.o and b/build/wm.o differ diff --git a/iso_root/boredos.elf b/iso_root/boredos.elf index 0af98d3..ceb34e0 100755 Binary files a/iso_root/boredos.elf and b/iso_root/boredos.elf differ diff --git a/src/kernel/about.c b/src/kernel/about.c index 33f05d4..8922505 100644 --- a/src/kernel/about.c +++ b/src/kernel/about.c @@ -14,7 +14,7 @@ static void about_paint(Window *win) { // Version info draw_string(offset_x, offset_y + 105, "BoredOS 'Panda'", COLOR_WHITE); - draw_string(offset_x, offset_y + 120, "BoredOS Version 1.61", COLOR_WHITE); + draw_string(offset_x, offset_y + 120, "BoredOS Version 1.62", COLOR_WHITE); draw_string(offset_x, offset_y + 135, "Kernel Version 2.5.2", COLOR_WHITE); // Copyright diff --git a/src/kernel/cli_apps/boredver.c b/src/kernel/cli_apps/boredver.c index e821007..2389d93 100644 --- a/src/kernel/cli_apps/boredver.c +++ b/src/kernel/cli_apps/boredver.c @@ -2,6 +2,6 @@ void cli_cmd_boredver(char *args) { (void)args; - cli_write("BoredOS v1.61\n"); + cli_write("BoredOS v1.62\n"); cli_write("BoredOS Kernel V2.5.2\n"); } diff --git a/src/kernel/cmd.c b/src/kernel/cmd.c index dd0cdb2..1d75842 100644 --- a/src/kernel/cmd.c +++ b/src/kernel/cmd.c @@ -1603,7 +1603,9 @@ static void create_test_files(void) { fat32_write(fh, (void *)content, 32); fat32_close(fh); } - + + fat32_open("Desktop/Recycle Bin.shortcut", "w"); + fh = fat32_open("Apps/wordofgod.c", "w"); if (fh) { diff --git a/src/kernel/explorer.c b/src/kernel/explorer.c index 24c654e..ce8bda9 100644 --- a/src/kernel/explorer.c +++ b/src/kernel/explorer.c @@ -201,16 +201,15 @@ static void explorer_draw_icon_label(int x, int y, const char *label, uint32_t c // Center in EXPLORER_ITEM_WIDTH int l1_len = 0; while(line1[l1_len]) l1_len++; int l1_w = l1_len * 8; - draw_string(x + (EXPLORER_ITEM_WIDTH - l1_w)/2, y + 50, line1, color); + draw_string(x + (EXPLORER_ITEM_WIDTH - l1_w)/2, y + 56, line1, color); if (line2[0]) { int l2_len = 0; while(line2[l2_len]) l2_len++; int l2_w = l2_len * 8; - draw_string(x + (EXPLORER_ITEM_WIDTH - l2_w)/2, y + 60, line2, color); + draw_string(x + (EXPLORER_ITEM_WIDTH - l2_w)/2, y + 66, line2, color); } } -// === Dialog and File Operations === static bool check_desktop_limit_explorer(Window *win) { ExplorerState *state = (ExplorerState*)win->data; @@ -888,31 +887,9 @@ static void explorer_open_item(Window *win, int index) { // Draw a simple file icon static void explorer_draw_file_icon(int x, int y, bool is_dir, uint32_t color, const char *filename) { if (is_dir) { - if (explorer_strcmp(filename, "RecycleBin") == 0) { - // Align with folder body position - draw_recycle_bin_icon(x - 19, y + 10, ""); - return; - } - // Folder icon (colored folder) - Desktop style - // Folder tab - draw_rect(x + 10, y + 10, 15, 6, COLOR_LTGRAY); - draw_rect(x + 10, y + 10, 15, 1, COLOR_BLACK); - draw_rect(x + 10, y + 10, 1, 6, COLOR_BLACK); - draw_rect(x + 24, y + 10, 1, 6, COLOR_BLACK); - - // Folder body - draw_rect(x + 10, y + 16, 25, 15, color); - draw_rect(x + 10, y + 16, 25, 1, COLOR_BLACK); - draw_rect(x + 10, y + 16, 1, 15, COLOR_BLACK); - draw_rect(x + 34, y + 16, 1, 15, COLOR_BLACK); - draw_rect(x + 10, y + 30, 25, 1, COLOR_BLACK); + if (explorer_strcmp(filename, "RecycleBin") == 0) draw_recycle_bin_icon(x + 5, y + 5, ""); + else draw_folder_icon(x + 5, y + 5, ""); } else if (explorer_str_ends_with(filename, ".shortcut")) { - // App Shortcut - Draw specific icon - // Strip extension for check - // Draw icon at x+5, y+5 - // The draw_*_icon functions in wm.c draw at x, y - // Pass a label, but avoid text drawn by the icon function inside the explorer item - // because explorer draws its own text. Pass "" as label. if (explorer_strcmp(filename, "Notepad.shortcut") == 0) draw_notepad_icon(x + 5, y + 5, ""); else if (explorer_strcmp(filename, "Calculator.shortcut") == 0) draw_calculator_icon(x + 5, y + 5, ""); else if (explorer_strcmp(filename, "Terminal.shortcut") == 0) draw_terminal_icon(x + 5, y + 5, ""); @@ -924,34 +901,11 @@ static void explorer_draw_file_icon(int x, int y, bool is_dir, uint32_t color, c else if (explorer_strcmp(filename, "RecycleBin") == 0) draw_recycle_bin_icon(x + 5, y + 5, ""); else draw_icon(x + 5, y + 5, ""); } else if (explorer_str_ends_with(filename, ".pnt")) { - draw_paint_icon(x - 15, y + 10, ""); + draw_paint_icon(x + 5, y + 5, ""); } else if (explorer_str_ends_with(filename, ".jpg") || explorer_str_ends_with(filename, ".JPG")) { - // Photo/image icon - draw_rect(x + 10, y + 10, 25, 20, 0xFF87CEEB); // Sky blue bg - draw_rect(x + 10, y + 22, 25, 8, 0xFF90EE90); // Green bottom (landscape) - draw_rect(x + 18, y + 16, 8, 6, 0xFFFFFF00); // Sun - draw_rect(x + 10, y + 10, 25, 1, 0xFF333333); // Border - draw_rect(x + 10, y + 10, 1, 20, 0xFF333333); - draw_rect(x + 34, y + 10, 1, 20, 0xFF333333); - draw_rect(x + 10, y + 29, 25, 1, 0xFF333333); + draw_image_icon(x + 5, y + 5, filename); } else { - // Document icon - larger - draw_rect(x + 12, y + 10, 20, 25, COLOR_WHITE); - draw_rect(x + 12, y + 10, 20, 2, COLOR_BLACK); - draw_rect(x + 12, y + 10, 2, 25, COLOR_BLACK); - draw_rect(x + 30, y + 10, 2, 25, COLOR_BLACK); - draw_rect(x + 12, y + 33, 20, 2, COLOR_BLACK); - - if (explorer_str_ends_with(filename, ".md")) { - draw_string(x + 14, y + 12, "MD", COLOR_BLACK); - } else if (explorer_str_ends_with(filename, ".c") || explorer_str_ends_with(filename, ".C")) { - draw_string(x + 14, y + 12, "C", COLOR_APPLE_BLUE); - } else { - // Lines on document - draw_rect(x + 15, y + 18, 14, 1, COLOR_DKGRAY); - draw_rect(x + 15, y + 23, 14, 1, COLOR_DKGRAY); - draw_rect(x + 15, y + 28, 14, 1, COLOR_DKGRAY); - } + draw_document_icon(x + 5, y + 5, ""); } } diff --git a/src/kernel/graphics.c b/src/kernel/graphics.c index 77ce20d..5591463 100644 --- a/src/kernel/graphics.c +++ b/src/kernel/graphics.c @@ -31,6 +31,11 @@ static uint32_t g_back_buffer[MAX_FB_WIDTH * MAX_FB_HEIGHT] __attribute__((align static int g_clip_x = 0, g_clip_y = 0, g_clip_w = 0, g_clip_h = 0; static bool g_clip_enabled = false; +// Custom Render Target +static uint32_t *g_render_target = NULL; +static int g_rt_width = 0; +static int g_rt_height = 0; + void graphics_init(struct limine_framebuffer *fb) { g_fb = fb; g_dirty.active = false; @@ -123,7 +128,21 @@ void graphics_clear_dirty(void) { asm volatile("push %0; popfq" : : "r"(rflags)); } +void graphics_set_render_target(uint32_t *buffer, int w, int h) { + g_render_target = buffer; + g_rt_width = w; + g_rt_height = h; +} + void put_pixel(int x, int y, uint32_t color) { + if (g_render_target) { + if (x >= 0 && x < g_rt_width && y >= 0 && y < g_rt_height) { + // No clipping in custom render targets yet, just bounding box + g_render_target[y * g_rt_width + x] = color; + } + return; + } + if (!g_fb) return; if (x < 0 || x >= (int)g_fb->width || y < 0 || y >= (int)g_fb->height) return; @@ -140,9 +159,26 @@ void put_pixel(int x, int y, uint32_t color) { } void draw_rect(int x, int y, int w, int h, uint32_t color) { - if (!g_fb) return; - int x1 = x, y1 = y, x2 = x + w, y2 = y + h; + + if (g_render_target) { + if (x1 < 0) x1 = 0; + if (y1 < 0) y1 = 0; + if (x2 > g_rt_width) x2 = g_rt_width; + if (y2 > g_rt_height) y2 = g_rt_height; + if (x1 >= x2 || y1 >= y2) return; + + for (int i = y1; i < y2; i++) { + uint32_t *row = &g_render_target[i * g_rt_width + x1]; + int len = x2 - x1; + for (int j = 0; j < len; j++) { + row[j] = color; + } + } + return; + } + + if (!g_fb) return; if (g_clip_enabled) { if (x1 < g_clip_x) x1 = g_clip_x; diff --git a/src/kernel/graphics.h b/src/kernel/graphics.h index 0b76426..ed88638 100644 --- a/src/kernel/graphics.h +++ b/src/kernel/graphics.h @@ -22,6 +22,7 @@ void draw_desktop_background(void); void graphics_set_bg_color(uint32_t color); void graphics_set_bg_pattern(const uint32_t *pattern); // 128x128 pattern void graphics_set_bg_image(uint32_t *pixels, int w, int h); // Full-screen wallpaper image +void graphics_set_render_target(uint32_t *buffer, int w, int h); void draw_boredos_logo(int x, int y, int scale); diff --git a/src/kernel/images/.DS_Store b/src/kernel/images/.DS_Store index d9306a3..da96730 100644 Binary files a/src/kernel/images/.DS_Store and b/src/kernel/images/.DS_Store differ diff --git a/src/kernel/wm.c b/src/kernel/wm.c index cc636df..670d213 100644 --- a/src/kernel/wm.c +++ b/src/kernel/wm.c @@ -187,7 +187,7 @@ static void refresh_desktop_icons(void) { // 3. Layout Icons if (desktop_auto_align) { int start_x = 20; - int start_y = 50; + int start_y = 30; int grid_x = 0; int grid_y = 0; @@ -338,13 +338,13 @@ static void draw_icon_label(int x, int y, const char *label) { int l1_len = 0; while(line1[l1_len]) l1_len++; int l1_w = l1_len * 8; // x passed is cell left. Center is x + 40. Text start is x + 40 - w/2 - draw_string(x + (80 - l1_w)/2, y + 30, line1, COLOR_WHITE); + draw_string(x + (80 - l1_w)/2, y + 48, line1, COLOR_WHITE); // Draw Line 2 Centered if (line2[0]) { int l2_len = 0; while(line2[l2_len]) l2_len++; int l2_w = l2_len * 8; - draw_string(x + (80 - l2_w)/2, y + 40, line2, COLOR_WHITE); + draw_string(x + (80 - l2_w)/2, y + 58, line2, COLOR_WHITE); } } @@ -376,192 +376,231 @@ void draw_button(int x, int y, int w, int h, const char *text, bool pressed) { draw_string(tx, ty, text, COLOR_BLACK); } +// Forward declarations for dock icons +static void draw_dock_files(int x, int y); +static void draw_dock_settings(int x, int y); +static void draw_dock_notepad(int x, int y); +static void draw_dock_calculator(int x, int y); +static void draw_dock_terminal(int x, int y); +static void draw_dock_minesweeper(int x, int y); +static void draw_dock_paint(int x, int y); +static void draw_dock_editor(int x, int y); +static void draw_filled_circle(int cx, int cy, int r, uint32_t color); + +static void draw_scaled_icon(int x, int y, void (*draw_fn)(int, int)) { + // 48x48 buffer for the dock icon + uint32_t icon_buf[48 * 48]; + // Clear to magenta (transparent key color) + for (int i = 0; i < 48 * 48; i++) icon_buf[i] = 0xFFFF00FF; + + // Redirect graphics to our buffer + graphics_set_render_target(icon_buf, 48, 48); + // Draw at 0,0 in the buffer + draw_fn(0, 0); + // Restore graphics to screen + graphics_set_render_target(NULL, 0, 0); + + // Calculate centered x,y in the 80x80 cell + // (80-32)/2 = 24. + int dx = x + 24, dy = y + 12; + + // Blit scaled down (nearest neighbor 48x48 -> 32x32 downsample, ratio = 1.5) + for (int ty = 0; ty < 32; ty++) { + for (int tx = 0; tx < 32; tx++) { + int src_x = tx * 48 / 32; + int src_y = ty * 48 / 32; + uint32_t c1 = icon_buf[src_y * 48 + src_x]; + if (c1 != 0xFFFF00FF) { + put_pixel(dx + tx, dy + ty, c1); + } + } + } +} + void draw_icon(int x, int y, const char *label) { - // Simple "File" Icon - draw_rect(x + 29, y, 20, 25, COLOR_WHITE); - draw_rect(x + 29, y, 20, 1, COLOR_BLACK); - draw_rect(x + 29, y, 1, 25, COLOR_BLACK); - draw_rect(x + 49, y, 1, 25, COLOR_BLACK); - draw_rect(x + 29, y + 25, 21, 1, COLOR_BLACK); + uint32_t icon_buf[48 * 48]; + for (int i = 0; i < 48 * 48; i++) icon_buf[i] = 0xFFFF00FF; + graphics_set_render_target(icon_buf, 48, 48); - // Label - draw_icon_label(x, y, label); -} - -void draw_folder_icon(int x, int y, const char *label) { - // Folder icon (yellow folder) - // Folder tab - draw_rect(x + 27, y, 15, 6, COLOR_LTGRAY); - draw_rect(x + 27, y, 15, 1, COLOR_BLACK); - draw_rect(x + 27, y, 1, 6, COLOR_BLACK); - draw_rect(x + 41, y, 1, 6, COLOR_BLACK); + draw_rounded_rect_filled(0, 0, 48, 48, 10, 0xFFE0E0E0); + draw_rounded_rect_filled(5, 5, 38, 38, 4, 0xFFFFFFFF); + draw_rect(12, 15, 24, 2, 0xFFCCCCCC); + draw_rect(12, 25, 24, 2, 0xFFCCCCCC); + draw_rect(12, 35, 16, 2, 0xFFCCCCCC); - // Folder body - draw_rect(x + 27, y + 6, 25, 15, COLOR_APPLE_YELLOW); - draw_rect(x + 27, y + 6, 25, 1, COLOR_BLACK); - draw_rect(x + 27, y + 6, 1, 15, COLOR_BLACK); - draw_rect(x + 51, y + 6, 1, 15, COLOR_BLACK); - draw_rect(x + 27, y + 20, 25, 1, COLOR_BLACK); + graphics_set_render_target(NULL, 0, 0); - // Label - draw_icon_label(x, y, label); -} - -void draw_document_icon(int x, int y, const char *label) { - // Document icon (white paper with lines) - draw_rect(x + 29, y, 20, 25, COLOR_WHITE); - draw_rect(x + 29, y, 20, 1, COLOR_BLACK); - draw_rect(x + 29, y, 1, 25, COLOR_BLACK); - draw_rect(x + 49, y, 1, 25, COLOR_BLACK); - draw_rect(x + 29, y + 25, 21, 1, COLOR_BLACK); - - // Lines on document - draw_rect(x + 33, y + 8, 12, 1, COLOR_BLACK); - draw_rect(x + 33, y + 12, 12, 1, COLOR_BLACK); - draw_rect(x + 33, y + 16, 12, 1, COLOR_BLACK); - - // Label - draw_icon_label(x, y, label); -} - -void draw_notepad_icon(int x, int y, const char *label) { - // Notepad icon (Blue notebook) - draw_rect(x + 29, y, 20, 25, COLOR_BLUE); - draw_rect(x + 29, y, 20, 1, COLOR_BLACK); - draw_rect(x + 29, y, 1, 25, COLOR_BLACK); - draw_rect(x + 49, y, 1, 25, COLOR_BLACK); - draw_rect(x + 29, y + 25, 21, 1, COLOR_BLACK); - - // White page inside - draw_rect(x + 31, y + 2, 17, 22, COLOR_WHITE); - // Lines - draw_rect(x + 33, y + 6, 13, 1, COLOR_GRAY); - draw_rect(x + 33, y + 10, 13, 1, COLOR_GRAY); - draw_rect(x + 33, y + 14, 13, 1, COLOR_GRAY); - - draw_icon_label(x, y, label); -} - -void draw_calculator_icon(int x, int y, const char *label) { - // Calculator icon - draw_rect(x + 29, y, 20, 25, COLOR_DKGRAY); - draw_rect(x + 29, y, 20, 1, COLOR_BLACK); - draw_rect(x + 29, y, 1, 25, COLOR_BLACK); - draw_rect(x + 49, y, 1, 25, COLOR_BLACK); - draw_rect(x + 29, y + 25, 21, 1, COLOR_BLACK); - - // Screen - draw_rect(x + 32, y + 3, 14, 6, COLOR_APPLE_GREEN); - - // Buttons - for(int r=0; r<3; r++) { - for(int c=0; c<3; c++) { - draw_rect(x + 32 + c*5, y + 12 + r*4, 3, 2, COLOR_WHITE); + int dx = x + 24, dy = y + 12; + for (int ty = 0; ty < 32; ty++) { + for (int tx = 0; tx < 32; tx++) { + int src_x = tx * 48 / 32; + int src_y = ty * 48 / 32; + uint32_t c1 = icon_buf[src_y * 48 + src_x]; + if (c1 != 0xFFFF00FF) put_pixel(dx + tx, dy + ty, c1); } } draw_icon_label(x, y, label); } +void draw_folder_icon(int x, int y, const char *label) { + draw_scaled_icon(x, y, draw_dock_files); + draw_icon_label(x, y, label); +} + +void draw_document_icon(int x, int y, const char *label) { + uint32_t icon_buf[48 * 48]; + for (int i = 0; i < 48 * 48; i++) icon_buf[i] = 0xFFFF00FF; + graphics_set_render_target(icon_buf, 48, 48); + + // Document dock style (making the source drawing slightly smaller to reduce final size) + draw_rounded_rect_filled(4, 4, 40, 40, 8, 0xFFFFFFFF); + draw_rounded_rect_filled(8, 8, 32, 32, 4, 0xFFF5F5F5); + draw_rect(14, 17, 20, 2, 0xFFBBBBBB); + draw_rect(14, 25, 20, 2, 0xFFBBBBBB); + draw_rect(14, 33, 14, 2, 0xFFBBBBBB); + + graphics_set_render_target(NULL, 0, 0); + int dx = x + 24, dy = y + 12; + for (int ty = 0; ty < 32; ty++) { + for (int tx = 0; tx < 32; tx++) { + int src_x = tx * 48 / 32; + int src_y = ty * 48 / 32; + uint32_t c1 = icon_buf[src_y * 48 + src_x]; + if (c1 != 0xFFFF00FF) put_pixel(dx + tx, dy + ty, c1); + } + } + + draw_icon_label(x, y, label); +} + +void draw_image_icon(int x, int y, const char *label) { + uint32_t icon_buf[48 * 48]; + for (int i = 0; i < 48 * 48; i++) icon_buf[i] = 0xFFFF00FF; + graphics_set_render_target(icon_buf, 48, 48); + + uint32_t *thumb = NULL; + if (str_eq(label, "moon.jpg") == 0) thumb = wallpaper_get_thumb(0); + else if (str_eq(label, "mountain.jpg") == 0) thumb = wallpaper_get_thumb(1); + else if (str_eq(label, "moon") == 0) thumb = wallpaper_get_thumb(0); + else if (str_eq(label, "mountain") == 0) thumb = wallpaper_get_thumb(1); + + if (!thumb) { + if (str_ends_with(label, "moon.jpg")) thumb = wallpaper_get_thumb(0); + else if (str_ends_with(label, "mountain.jpg")) thumb = wallpaper_get_thumb(1); + } + + if (thumb) { + // White border + draw_rounded_rect_filled(0, 0, 48, 48, 4, 0xFFFFFFFF); + int dst_w = 44, dst_h = 44; + for (int ty = 0; ty < dst_h; ty++) { + for (int tx = 0; tx < dst_w; tx++) { + int sx = tx * 100 / dst_w; + int sy = ty * 60 / dst_h; + put_pixel(2 + tx, 2 + ty, thumb[sy * 100 + sx]); + } + } + } else { + // Fallback photo + draw_rounded_rect_filled(0, 0, 48, 48, 10, 0xFFE0E0E0); + draw_rounded_rect_filled(5, 5, 38, 38, 4, 0xFF87CEEB); // Sky + draw_rect(5, 25, 38, 18, 0xFF90EE90); // Grass + draw_filled_circle(15, 15, 6, 0xFFFFFF00); // Sun + } + + graphics_set_render_target(NULL, 0, 0); + int dx = x + 24, dy = y + 12; + for (int ty = 0; ty < 32; ty++) { + for (int tx = 0; tx < 32; tx++) { + int src_x = tx * 48 / 32; + int src_y = ty * 48 / 32; + uint32_t c1 = icon_buf[src_y * 48 + src_x]; + if (c1 != 0xFFFF00FF) put_pixel(dx + tx, dy + ty, c1); + } + } + + // Removing the explicit `draw_icon_label` call here to prevent double-text since `wm.c` or Explorer manually draws it as well inside their draw block +} + +void draw_notepad_icon(int x, int y, const char *label) { + draw_scaled_icon(x, y, draw_dock_notepad); + draw_icon_label(x, y, label); +} + +void draw_calculator_icon(int x, int y, const char *label) { + draw_scaled_icon(x, y, draw_dock_calculator); + draw_icon_label(x, y, label); +} + void draw_terminal_icon(int x, int y, const char *label) { - // Terminal icon - draw_rect(x + 27, y + 2, 24, 20, COLOR_BLACK); - draw_rect(x + 27, y + 2, 24, 1, COLOR_GRAY); - draw_rect(x + 27, y + 2, 1, 20, COLOR_GRAY); - draw_rect(x + 51, y + 2, 1, 20, COLOR_GRAY); - draw_rect(x + 27, y + 22, 25, 1, COLOR_GRAY); - - // Prompt - draw_rect(x + 31, y + 6, 4, 1, COLOR_APPLE_GREEN); // > - draw_rect(x + 32, y + 7, 2, 1, COLOR_APPLE_GREEN); - draw_rect(x + 31, y + 8, 4, 1, COLOR_APPLE_GREEN); - draw_rect(x + 37, y + 6, 6, 1, COLOR_APPLE_GREEN); // _ - + draw_scaled_icon(x, y, draw_dock_terminal); draw_icon_label(x, y, label); } void draw_minesweeper_icon(int x, int y, const char *label) { - // Mine icon - draw_rect(x + 29, y, 20, 25, COLOR_LTGRAY); - draw_rect(x + 29, y, 20, 1, COLOR_BLACK); - draw_rect(x + 29, y, 1, 25, COLOR_BLACK); - draw_rect(x + 49, y, 1, 25, COLOR_BLACK); - draw_rect(x + 29, y + 25, 21, 1, COLOR_BLACK); - - // Mine - draw_rect(x + 36, y + 8, 6, 8, COLOR_BLACK); - draw_rect(x + 34, y + 10, 10, 4, COLOR_BLACK); - // Spikes - draw_rect(x + 39, y + 6, 1, 12, COLOR_BLACK); - draw_rect(x + 33, y + 12, 12, 1, COLOR_BLACK); - + draw_scaled_icon(x, y, draw_dock_minesweeper); draw_icon_label(x, y, label); } void draw_control_panel_icon(int x, int y, const char *label) { - // Control Panel (Gear/Sliders) - draw_rect(x + 29, y, 20, 25, COLOR_GRAY); - draw_rect(x + 29, y, 20, 1, COLOR_BLACK); - draw_rect(x + 29, y, 1, 25, COLOR_BLACK); - draw_rect(x + 49, y, 1, 25, COLOR_BLACK); - draw_rect(x + 29, y + 25, 21, 1, COLOR_BLACK); - - // Sliders - draw_rect(x + 34, y + 5, 2, 15, COLOR_DKGRAY); - draw_rect(x + 33, y + 10, 4, 3, COLOR_WHITE); // Knob - - draw_rect(x + 42, y + 5, 2, 15, COLOR_DKGRAY); - draw_rect(x + 41, y + 16, 4, 3, COLOR_WHITE); // Knob - + draw_scaled_icon(x, y, draw_dock_settings); draw_icon_label(x, y, label); } void draw_about_icon(int x, int y, const char *label) { - // About icon (Info) - draw_rect(x + 29, y, 20, 25, COLOR_WHITE); - draw_rect(x + 29, y, 20, 1, COLOR_BLACK); - draw_rect(x + 29, y, 1, 25, COLOR_BLACK); - draw_rect(x + 49, y, 1, 25, COLOR_BLACK); - draw_rect(x + 29, y + 25, 21, 1, COLOR_BLACK); + uint32_t icon_buf[48 * 48]; + for (int i = 0; i < 48 * 48; i++) icon_buf[i] = 0xFFFF00FF; + graphics_set_render_target(icon_buf, 48, 48); - // 'i' - draw_rect(x + 38, y + 5, 3, 3, COLOR_BLUE); // Dot - draw_rect(x + 38, y + 10, 3, 10, COLOR_BLUE); // Body + // About dock style + draw_rounded_rect_filled(0, 0, 48, 48, 10, 0xFF4285F4); + draw_rounded_rect_filled(5, 5, 38, 38, 4, 0xFFE8F0FE); + draw_rect(22, 15, 4, 4, 0xFF4285F4); // Dot + draw_rect(22, 23, 4, 16, 0xFF4285F4); // Body + + graphics_set_render_target(NULL, 0, 0); + int dx = x + 24, dy = y + 12; + for (int ty = 0; ty < 32; ty++) { + for (int tx = 0; tx < 32; tx++) { + int src_x = tx * 48 / 32; + int src_y = ty * 48 / 32; + uint32_t c1 = icon_buf[src_y * 48 + src_x]; + if (c1 != 0xFFFF00FF) put_pixel(dx + tx, dy + ty, c1); + } + } draw_icon_label(x, y, label); } void draw_recycle_bin_icon(int x, int y, const char *label) { - // Recycle Bin (Trash can) - draw_rect(x + 29, y, 20, 25, COLOR_LTGRAY); - draw_rect(x + 29, y, 20, 1, COLOR_BLACK); - draw_rect(x + 29, y, 1, 25, COLOR_BLACK); - draw_rect(x + 49, y, 1, 25, COLOR_BLACK); - draw_rect(x + 29, y + 25, 21, 1, COLOR_BLACK); + uint32_t icon_buf[48 * 48]; + for (int i = 0; i < 48 * 48; i++) icon_buf[i] = 0xFFFF00FF; + graphics_set_render_target(icon_buf, 48, 48); - // Ribs - draw_rect(x + 32, y + 5, 2, 15, COLOR_DKGRAY); - draw_rect(x + 38, y + 5, 2, 15, COLOR_DKGRAY); - draw_rect(x + 44, y + 5, 2, 15, COLOR_DKGRAY); + // Recycle bin dock style + draw_rounded_rect_filled(0, 0, 48, 48, 10, 0xFFECEFF1); + draw_rounded_rect_filled(5, 5, 38, 38, 4, 0xFFCFD8DC); + draw_rect(16, 18, 16, 20, 0xFF90A4AE); // Bin body + draw_rect(12, 15, 24, 3, 0xFF78909C); // Bin lid + draw_rect(20, 13, 8, 2, 0xFF78909C); // Handle + + graphics_set_render_target(NULL, 0, 0); + int dx = x + 24, dy = y + 12; + for (int ty = 0; ty < 32; ty++) { + for (int tx = 0; tx < 32; tx++) { + int src_x = tx * 48 / 32; + int src_y = ty * 48 / 32; + uint32_t c1 = icon_buf[src_y * 48 + src_x]; + if (c1 != 0xFFFF00FF) put_pixel(dx + tx, dy + ty, c1); + } + } draw_icon_label(x, y, label); } void draw_paint_icon(int x, int y, const char *label) { - // Paint Palette Icon - draw_rect(x + 27, y + 2, 26, 20, COLOR_WHITE); - draw_rect(x + 27, y + 2, 26, 1, COLOR_BLACK); - draw_rect(x + 27, y + 2, 1, 20, COLOR_BLACK); - draw_rect(x + 52, y + 2, 1, 20, COLOR_BLACK); - draw_rect(x + 27, y + 22, 26, 1, COLOR_BLACK); - - // Color dots - draw_rect(x + 30, y + 5, 4, 4, COLOR_RED); - draw_rect(x + 38, y + 5, 4, 4, COLOR_APPLE_GREEN); - draw_rect(x + 46, y + 5, 4, 4, COLOR_APPLE_BLUE); - draw_rect(x + 30, y + 13, 4, 4, COLOR_APPLE_YELLOW); - draw_rect(x + 38, y + 13, 4, 4, COLOR_PURPLE); - + draw_scaled_icon(x, y, draw_dock_paint); draw_icon_label(x, y, label); } @@ -928,16 +967,8 @@ void wm_paint(void) { else draw_icon(icon->x, icon->y, label); } else { if (str_ends_with(icon->name, ".pnt")) draw_paint_icon(icon->x, icon->y, icon->name); - else if (str_ends_with(icon->name, ".md")) { - draw_document_icon(icon->x, icon->y, icon->name); - draw_string(icon->x + 31, icon->y + 2, "MD", COLOR_DARK_TEXT); - } else if (str_ends_with(icon->name, ".c") || str_ends_with(icon->name, ".C")) { - draw_document_icon(icon->x, icon->y, icon->name); - draw_string(icon->x + 31, icon->y + 2, "C", COLOR_APPLE_BLUE); - } else if (str_ends_with(icon->name, ".jpg") || str_ends_with(icon->name, ".JPG")) { - draw_document_icon(icon->x, icon->y, icon->name); - draw_string(icon->x + 27, icon->y + 2, "JPG", 0xFF44BB44); + draw_image_icon(icon->x, icon->y, icon->name); } else draw_document_icon(icon->x, icon->y, icon->name); } diff --git a/src/kernel/wm.h b/src/kernel/wm.h index bf67052..6de58b1 100644 --- a/src/kernel/wm.h +++ b/src/kernel/wm.h @@ -87,6 +87,7 @@ void draw_traffic_light(int x, int y); // Red close button only void draw_icon(int x, int y, const char *label); void draw_folder_icon(int x, int y, const char *label); void draw_document_icon(int x, int y, const char *label); +void draw_image_icon(int x, int y, const char *label); void draw_notepad_icon(int x, int y, const char *label); void draw_calculator_icon(int x, int y, const char *label); void draw_terminal_icon(int x, int y, const char *label);