Fetcher: Proper desktop icons!

main
Ry 2023-07-12 17:32:28 -07:00
parent 20e25f963e
commit 7d4918041b
7 changed files with 34 additions and 10 deletions

View File

@ -25,6 +25,7 @@ base_image/terminal.fxf: applications/terminal/main.asm $(wildcard applications/
$(FOX32ASM) $< $@
base_image/fetcher.fxf: applications/fetcher/Fetcher.okm $(wildcard applications/fetcher/*.okm)
$(GFX2INC) 32 32 applications/fetcher/icons/disk.png applications/fetcher/icons/disk.inc
lua $(OKAMERON) -arch=fox32 -startup=applications/fetcher/start.asm $< \
applications/fetcher/Browser.okm \
applications/fetcher/Desktop.okm \

View File

@ -1,5 +1,5 @@
MODULE Browser;
IMPORT OS;
IMPORT OS, Desktop;
VAR browserRunning: CHAR;
browserWindow: ARRAY 36 OF CHAR;
@ -36,7 +36,7 @@ MODULE Browser;
draw_filled_rectangle_to_overlay(x, y, w, h, 0, get_window_overlay_number(desktopWin));
i := i + 1;
END;
draw_widgets_to_window(desktopWin);
DrawDesktopIcons(desktopWin);
END;
ELSIF eventArgs[2] <| 16 THEN
start_dragging_window(PTROF(browserWindow));

View File

@ -5,6 +5,8 @@ MODULE Desktop;
desktopWindow: ARRAY 36 OF CHAR;
desktopIcons: ARRAY 5 OF Fox32OSButtonWidget;
EXTERN diskIcon: ARRAY 1024 OF INT;
PROCEDURE DesktopMain();
BEGIN
desktopRunning := 1;
@ -12,11 +14,11 @@ MODULE Desktop;
(* set up the desktop icon widgets *)
SetupDesktopIconStructs();
(* create the window and make it fully transparent, draw the button widgets to it, and mark it as "always background *)
(* create the window and make it fully transparent, mark it as "always background", and draw the icons to it *)
new_window(PTROF(desktopWindow), "Desktop", 640, 448, 0, 16, 0, PTROF(desktopIcons));
fill_overlay(000000000H, get_window_overlay_number(PTROF(desktopWindow)));
draw_widgets_to_window(PTROF(desktopWindow));
set_window_flags(000000001H, PTROF(desktopWindow));
DrawDesktopIcons(PTROF(desktopWindow));
WHILE desktopRunning DO
GetNextWindowEvent(PTROF(desktopWindow));
@ -53,7 +55,7 @@ MODULE Desktop;
END;
(* redraw the icons *)
draw_widgets_to_window(PTROF(desktopWindow));
DrawDesktopIcons(PTROF(desktopWindow));
(* launch a new instance of Fetcher *)
IF launch_fxf_from_disk("fetcher.fxf", get_boot_disk_id(), 0FFFFFFFFH, buttonId, icon^.x, icon^.y, PTROF(desktopWindow)) = 0FFFFFFFFH THEN
@ -61,6 +63,26 @@ MODULE Desktop;
END;
END;
PROCEDURE DrawDesktopIcons(desktopWin: PTR;);
VAR i, y, overlay: INT;
BEGIN
IF desktopWin = 0 THEN RETURN(); END;
(* draw the buttons themselves *)
draw_widgets_to_window(desktopWin);
(* set the tilemap and draw the icons! *)
set_tilemap(PTROF(diskIcon), 32, 32);
overlay := get_window_overlay_number(desktopWin);
i := 5;
y := 16;
WHILE i DO
draw_tile_to_overlay(0, 592, y, overlay);
y := y + 64;
i := i - 1;
END;
END;
PROCEDURE SetupDesktopIconStructs();
VAR desktopIcon: POINTER TO Fox32OSButtonWidget;
prevDesktopIcon: POINTER TO Fox32OSButtonWidget;

View File

@ -3,7 +3,7 @@ MODULE OS;
draw_widgets_to_window, draw_filled_rectangle_to_overlay, GetNextWindowEvent, DrawPixel,
save_state_and_yield_task, start_dragging_window, handle_widget_click, fill_window, fill_overlay,
set_window_flags, menu_update_event, menu_bar_click_event, close_menu, new_messagebox,
launch_fxf_from_disk, get_boot_disk_id, string_to_int: INT;
launch_fxf_from_disk, get_boot_disk_id, string_to_int, set_tilemap, draw_tile_to_overlay: INT;
EXTERN PROCEDURE brk: INT;

View File

@ -0,0 +1 @@
*.inc

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -34,10 +34,7 @@ brk:
ret
PortIn:
push r1
in r1, r0
mov r0, r1
pop r1
in r0, r0
ret
eventArgs: data.fill 0, 32
@ -47,5 +44,8 @@ arg1Ptr: data.32 0
arg2Ptr: data.32 0
arg3Ptr: data.32 0
diskIcon:
#include "icons/disk.inc"
#include "../../../fox32rom/fox32rom.def"
#include "../../fox32os.def"