From 7d4918041b42d3d989d5dca2fd9a7aeb60ab529f Mon Sep 17 00:00:00 2001 From: Ry Date: Wed, 12 Jul 2023 17:32:28 -0700 Subject: [PATCH] Fetcher: Proper desktop icons! --- Makefile | 1 + applications/fetcher/Browser.okm | 4 ++-- applications/fetcher/Desktop.okm | 28 +++++++++++++++++++++++--- applications/fetcher/OS.okm | 2 +- applications/fetcher/icons/.gitignore | 1 + applications/fetcher/icons/disk.png | Bin 0 -> 4464 bytes applications/fetcher/start.asm | 8 ++++---- 7 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 applications/fetcher/icons/.gitignore create mode 100644 applications/fetcher/icons/disk.png diff --git a/Makefile b/Makefile index 538588c..333ffcb 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/applications/fetcher/Browser.okm b/applications/fetcher/Browser.okm index 3eebe9b..8d9bb2f 100644 --- a/applications/fetcher/Browser.okm +++ b/applications/fetcher/Browser.okm @@ -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)); diff --git a/applications/fetcher/Desktop.okm b/applications/fetcher/Desktop.okm index 6822eca..69aa574 100644 --- a/applications/fetcher/Desktop.okm +++ b/applications/fetcher/Desktop.okm @@ -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; diff --git a/applications/fetcher/OS.okm b/applications/fetcher/OS.okm index ff1f05e..53f231d 100644 --- a/applications/fetcher/OS.okm +++ b/applications/fetcher/OS.okm @@ -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; diff --git a/applications/fetcher/icons/.gitignore b/applications/fetcher/icons/.gitignore new file mode 100644 index 0000000..2a06e93 --- /dev/null +++ b/applications/fetcher/icons/.gitignore @@ -0,0 +1 @@ +*.inc diff --git a/applications/fetcher/icons/disk.png b/applications/fetcher/icons/disk.png new file mode 100644 index 0000000000000000000000000000000000000000..7c3bee062cab340f8ded323282ff53567b308922 GIT binary patch literal 4464 zcmeHLdsGuw8V^1IkyZ+#D2PL_isEE4dCwdoAc+t)$jc1{ZJA_l!Wi-(8At>l;A<_4 zSaz+}TD2lrE444X>+>kP3hWljanZKx+RCnV=_<-%wOYlxcM@Kn_M9Hh+5SgzGBfwP zzwdXy?{~j@&z-!QmYV!rz|;U9kN2D=MU?^X2>0_J1+Tqfw`<_-PDxfan?bn{yTfK= z3IM{cv;zdV86%J9zEYW)~ck)*!#Yvy>FFib}!tqVqAP<-lnK& z-QBuJWM%BE<@J-Wjd?e3UfrHG^$*4SG^e^7FV25*uKjXe!n&B6dw*AyMYpAwF01bR zk;tEUA}aUJ0(1HMOIB5uFIzhyz_+@o^;lDR*o=s+?4?}coR@F+99vy;=yK`du${GZ zrW=T2x1AOpPHcNJumkIB_bfUXHFedbO<($t-B{sj zZv3JnHqoa=DOkb2`a|ZMxi#@!@ofvIM_w!bqkC)p$2^|TdL}6;O_P+=pE=BT&+6Bd zDSu9gxbRA5EkD$6e1(F3C-w70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MQpQNrit>8sD&_;F0-f%EgvR2`UmE_Pbb=^PMpH^HrlnlPq)A$qs&Zzt97*O}C< zH<9KKzF$Au_Y2+bt5sd&ZrsWjY}%idLoELj;?&{*3(a}em9!xN`$84C~ SRw;sM@igjG)zSHR>;4BIIa-te literal 0 HcmV?d00001 diff --git a/applications/fetcher/start.asm b/applications/fetcher/start.asm index 94aa694..6276008 100644 --- a/applications/fetcher/start.asm +++ b/applications/fetcher/start.asm @@ -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"