V1.62 bug fixes

This commit is contained in:
Chris 2026-02-24 22:45:24 +01:00
parent 106adf1ac8
commit 6e2f0d8c1a
20 changed files with 246 additions and 221 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -14,7 +14,7 @@ static void about_paint(Window *win) {
// Version info // Version info
draw_string(offset_x, offset_y + 105, "BoredOS 'Panda'", COLOR_WHITE); 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); draw_string(offset_x, offset_y + 135, "Kernel Version 2.5.2", COLOR_WHITE);
// Copyright // Copyright

View file

@ -2,6 +2,6 @@
void cli_cmd_boredver(char *args) { void cli_cmd_boredver(char *args) {
(void)args; (void)args;
cli_write("BoredOS v1.61\n"); cli_write("BoredOS v1.62\n");
cli_write("BoredOS Kernel V2.5.2\n"); cli_write("BoredOS Kernel V2.5.2\n");
} }

View file

@ -1604,6 +1604,8 @@ static void create_test_files(void) {
fat32_close(fh); fat32_close(fh);
} }
fat32_open("Desktop/Recycle Bin.shortcut", "w");
fh = fat32_open("Apps/wordofgod.c", "w"); fh = fat32_open("Apps/wordofgod.c", "w");
if (fh) { if (fh) {

View file

@ -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 // Center in EXPLORER_ITEM_WIDTH
int l1_len = 0; while(line1[l1_len]) l1_len++; int l1_len = 0; while(line1[l1_len]) l1_len++;
int l1_w = l1_len * 8; 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]) { if (line2[0]) {
int l2_len = 0; while(line2[l2_len]) l2_len++; int l2_len = 0; while(line2[l2_len]) l2_len++;
int l2_w = l2_len * 8; 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) { static bool check_desktop_limit_explorer(Window *win) {
ExplorerState *state = (ExplorerState*)win->data; ExplorerState *state = (ExplorerState*)win->data;
@ -888,31 +887,9 @@ static void explorer_open_item(Window *win, int index) {
// Draw a simple file icon // Draw a simple file icon
static void explorer_draw_file_icon(int x, int y, bool is_dir, uint32_t color, const char *filename) { static void explorer_draw_file_icon(int x, int y, bool is_dir, uint32_t color, const char *filename) {
if (is_dir) { if (is_dir) {
if (explorer_strcmp(filename, "RecycleBin") == 0) { if (explorer_strcmp(filename, "RecycleBin") == 0) draw_recycle_bin_icon(x + 5, y + 5, "");
// Align with folder body position else draw_folder_icon(x + 5, y + 5, "");
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);
} else if (explorer_str_ends_with(filename, ".shortcut")) { } 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, ""); 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, "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, ""); 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 if (explorer_strcmp(filename, "RecycleBin") == 0) draw_recycle_bin_icon(x + 5, y + 5, "");
else draw_icon(x + 5, y + 5, ""); else draw_icon(x + 5, y + 5, "");
} else if (explorer_str_ends_with(filename, ".pnt")) { } 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")) { } else if (explorer_str_ends_with(filename, ".jpg") || explorer_str_ends_with(filename, ".JPG")) {
// Photo/image icon draw_image_icon(x + 5, y + 5, filename);
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);
} else { } else {
// Document icon - larger draw_document_icon(x + 5, y + 5, "");
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);
}
} }
} }

View file

@ -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 int g_clip_x = 0, g_clip_y = 0, g_clip_w = 0, g_clip_h = 0;
static bool g_clip_enabled = false; 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) { void graphics_init(struct limine_framebuffer *fb) {
g_fb = fb; g_fb = fb;
g_dirty.active = false; g_dirty.active = false;
@ -123,7 +128,21 @@ void graphics_clear_dirty(void) {
asm volatile("push %0; popfq" : : "r"(rflags)); 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) { 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 (!g_fb) return;
if (x < 0 || x >= (int)g_fb->width || y < 0 || y >= (int)g_fb->height) return; if (x < 0 || x >= (int)g_fb->width || y < 0 || y >= (int)g_fb->height) return;
@ -140,10 +159,27 @@ void put_pixel(int x, int y, uint32_t color) {
} }
void draw_rect(int x, int y, int w, int h, 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; 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 (g_clip_enabled) {
if (x1 < g_clip_x) x1 = g_clip_x; if (x1 < g_clip_x) x1 = g_clip_x;
if (y1 < g_clip_y) y1 = g_clip_y; if (y1 < g_clip_y) y1 = g_clip_y;

View file

@ -22,6 +22,7 @@ void draw_desktop_background(void);
void graphics_set_bg_color(uint32_t color); void graphics_set_bg_color(uint32_t color);
void graphics_set_bg_pattern(const uint32_t *pattern); // 128x128 pattern 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_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); void draw_boredos_logo(int x, int y, int scale);

Binary file not shown.

View file

@ -187,7 +187,7 @@ static void refresh_desktop_icons(void) {
// 3. Layout Icons // 3. Layout Icons
if (desktop_auto_align) { if (desktop_auto_align) {
int start_x = 20; int start_x = 20;
int start_y = 50; int start_y = 30;
int grid_x = 0; int grid_x = 0;
int grid_y = 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_len = 0; while(line1[l1_len]) l1_len++;
int l1_w = l1_len * 8; int l1_w = l1_len * 8;
// x passed is cell left. Center is x + 40. Text start is x + 40 - w/2 // 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 // Draw Line 2 Centered
if (line2[0]) { if (line2[0]) {
int l2_len = 0; while(line2[l2_len]) l2_len++; int l2_len = 0; while(line2[l2_len]) l2_len++;
int l2_w = l2_len * 8; 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); draw_string(tx, ty, text, COLOR_BLACK);
} }
void draw_icon(int x, int y, const char *label) { // Forward declarations for dock icons
// Simple "File" Icon static void draw_dock_files(int x, int y);
draw_rect(x + 29, y, 20, 25, COLOR_WHITE); static void draw_dock_settings(int x, int y);
draw_rect(x + 29, y, 20, 1, COLOR_BLACK); static void draw_dock_notepad(int x, int y);
draw_rect(x + 29, y, 1, 25, COLOR_BLACK); static void draw_dock_calculator(int x, int y);
draw_rect(x + 49, y, 1, 25, COLOR_BLACK); static void draw_dock_terminal(int x, int y);
draw_rect(x + 29, y + 25, 21, 1, COLOR_BLACK); 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) {
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);
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);
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);
}
}
// Label
draw_icon_label(x, y, label); draw_icon_label(x, y, label);
} }
void draw_folder_icon(int x, int y, const char *label) { void draw_folder_icon(int x, int y, const char *label) {
// Folder icon (yellow folder) draw_scaled_icon(x, y, draw_dock_files);
// 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);
// 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);
// Label
draw_icon_label(x, y, label); draw_icon_label(x, y, label);
} }
void draw_document_icon(int x, int y, const char *label) { void draw_document_icon(int x, int y, const char *label) {
// Document icon (white paper with lines) uint32_t icon_buf[48 * 48];
draw_rect(x + 29, y, 20, 25, COLOR_WHITE); for (int i = 0; i < 48 * 48; i++) icon_buf[i] = 0xFFFF00FF;
draw_rect(x + 29, y, 20, 1, COLOR_BLACK); graphics_set_render_target(icon_buf, 48, 48);
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 // Document dock style (making the source drawing slightly smaller to reduce final size)
draw_rect(x + 33, y + 8, 12, 1, COLOR_BLACK); draw_rounded_rect_filled(4, 4, 40, 40, 8, 0xFFFFFFFF);
draw_rect(x + 33, y + 12, 12, 1, COLOR_BLACK); draw_rounded_rect_filled(8, 8, 32, 32, 4, 0xFFF5F5F5);
draw_rect(x + 33, y + 16, 12, 1, COLOR_BLACK); 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);
}
}
// Label
draw_icon_label(x, y, label); 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) { void draw_notepad_icon(int x, int y, const char *label) {
// Notepad icon (Blue notebook) draw_scaled_icon(x, y, draw_dock_notepad);
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); draw_icon_label(x, y, label);
} }
void draw_calculator_icon(int x, int y, const char *label) { void draw_calculator_icon(int x, int y, const char *label) {
// Calculator icon draw_scaled_icon(x, y, draw_dock_calculator);
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);
}
}
draw_icon_label(x, y, label); draw_icon_label(x, y, label);
} }
void draw_terminal_icon(int x, int y, const char *label) { void draw_terminal_icon(int x, int y, const char *label) {
// Terminal icon draw_scaled_icon(x, y, draw_dock_terminal);
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_icon_label(x, y, label); draw_icon_label(x, y, label);
} }
void draw_minesweeper_icon(int x, int y, const char *label) { void draw_minesweeper_icon(int x, int y, const char *label) {
// Mine icon draw_scaled_icon(x, y, draw_dock_minesweeper);
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_icon_label(x, y, label); draw_icon_label(x, y, label);
} }
void draw_control_panel_icon(int x, int y, const char *label) { void draw_control_panel_icon(int x, int y, const char *label) {
// Control Panel (Gear/Sliders) draw_scaled_icon(x, y, draw_dock_settings);
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_icon_label(x, y, label); draw_icon_label(x, y, label);
} }
void draw_about_icon(int x, int y, const char *label) { void draw_about_icon(int x, int y, const char *label) {
// About icon (Info) uint32_t icon_buf[48 * 48];
draw_rect(x + 29, y, 20, 25, COLOR_WHITE); for (int i = 0; i < 48 * 48; i++) icon_buf[i] = 0xFFFF00FF;
draw_rect(x + 29, y, 20, 1, COLOR_BLACK); graphics_set_render_target(icon_buf, 48, 48);
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);
// 'i' // About dock style
draw_rect(x + 38, y + 5, 3, 3, COLOR_BLUE); // Dot draw_rounded_rect_filled(0, 0, 48, 48, 10, 0xFF4285F4);
draw_rect(x + 38, y + 10, 3, 10, COLOR_BLUE); // Body 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); draw_icon_label(x, y, label);
} }
void draw_recycle_bin_icon(int x, int y, const char *label) { void draw_recycle_bin_icon(int x, int y, const char *label) {
// Recycle Bin (Trash can) uint32_t icon_buf[48 * 48];
draw_rect(x + 29, y, 20, 25, COLOR_LTGRAY); for (int i = 0; i < 48 * 48; i++) icon_buf[i] = 0xFFFF00FF;
draw_rect(x + 29, y, 20, 1, COLOR_BLACK); graphics_set_render_target(icon_buf, 48, 48);
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);
// Ribs // Recycle bin dock style
draw_rect(x + 32, y + 5, 2, 15, COLOR_DKGRAY); draw_rounded_rect_filled(0, 0, 48, 48, 10, 0xFFECEFF1);
draw_rect(x + 38, y + 5, 2, 15, COLOR_DKGRAY); draw_rounded_rect_filled(5, 5, 38, 38, 4, 0xFFCFD8DC);
draw_rect(x + 44, y + 5, 2, 15, COLOR_DKGRAY); 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); draw_icon_label(x, y, label);
} }
void draw_paint_icon(int x, int y, const char *label) { void draw_paint_icon(int x, int y, const char *label) {
// Paint Palette Icon draw_scaled_icon(x, y, draw_dock_paint);
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_icon_label(x, y, label); draw_icon_label(x, y, label);
} }
@ -928,16 +967,8 @@ void wm_paint(void) {
else draw_icon(icon->x, icon->y, label); else draw_icon(icon->x, icon->y, label);
} else { } else {
if (str_ends_with(icon->name, ".pnt")) draw_paint_icon(icon->x, icon->y, icon->name); 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")) { else if (str_ends_with(icon->name, ".jpg") || str_ends_with(icon->name, ".JPG")) {
draw_document_icon(icon->x, icon->y, icon->name); draw_image_icon(icon->x, icon->y, icon->name);
draw_string(icon->x + 27, icon->y + 2, "JPG", 0xFF44BB44);
} }
else draw_document_icon(icon->x, icon->y, icon->name); else draw_document_icon(icon->x, icon->y, icon->name);
} }

View file

@ -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_icon(int x, int y, const char *label);
void draw_folder_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_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_notepad_icon(int x, int y, const char *label);
void draw_calculator_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); void draw_terminal_icon(int x, int y, const char *label);