Fetcher: WIP "About" screen

This commit is contained in:
Ry 2023-07-15 21:56:09 -07:00
parent e28c2c3cdc
commit b832aa83be
4 changed files with 82 additions and 2 deletions

View File

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

View File

@ -0,0 +1,36 @@
MODULE About;
IMPORT OS;
VAR aboutRunning: CHAR;
aboutWindow: ARRAY 36 OF CHAR;
PROCEDURE AboutMain();
BEGIN
aboutRunning := 1;
new_window(PTROF(aboutWindow), "About", 256, 192, 192, 144, 0, 0);
DrawAboutWindow();
WHILE aboutRunning DO
GetNextWindowEvent(PTROF(aboutWindow));
(* mouse release event *)
IF eventArgs[0] = PTROF(EVENT_TYPE_MOUSE_RELEASE) THEN
destroy_window(PTROF(aboutWindow));
aboutRunning := 0;
END;
save_state_and_yield_task();
END;
END;
PROCEDURE DrawAboutWindow();
VAR overlay: INT;
BEGIN
overlay := get_window_overlay_number(PTROF(aboutWindow));
fill_overlay(0FF674764H, overlay);
draw_str_to_overlay("fox32", 16, 16, 0FFFFFFFFH, 0FF674764H, overlay);
draw_str_to_overlay("the computer made with love", 16, 32, 0FFFFFFFFH, 0FF674764H, overlay);
draw_filled_rectangle_to_overlay(4, 56, 248, 2, 0FFFFFFFFH, overlay);
END;
END.

View File

@ -1,5 +1,5 @@
MODULE Browser; MODULE Browser;
IMPORT OS, Desktop; IMPORT OS, About, Desktop;
VAR browserRunning: CHAR; VAR browserRunning: CHAR;
browserWindow: ARRAY 36 OF CHAR; browserWindow: ARRAY 36 OF CHAR;
@ -11,6 +11,7 @@ MODULE Browser;
browserDiskId: INT; browserDiskId: INT;
browserFileList: ARRAY 341 OF CHAR; browserFileList: ARRAY 341 OF CHAR;
EXTERN browserMenuItemsRoot: POINTER TO CHAR;
EXTERN browserFileListFriendly: ARRAY 12 OF POINTER TO CHAR; EXTERN browserFileListFriendly: ARRAY 12 OF POINTER TO CHAR;
PROCEDURE BrowserMain(diskId, iconX, iconY: INT; desktopWin: PTR;); PROCEDURE BrowserMain(diskId, iconX, iconY: INT; desktopWin: PTR;);
@ -36,7 +37,7 @@ MODULE Browser;
browserDiskId := diskId; browserDiskId := diskId;
(* create the window and draw its initial contents *) (* create the window and draw its initial contents *)
new_window(PTROF(browserWindow), "Fetcher", 384, 192, 64, 64, 0, PTROF(browserIcons)); new_window(PTROF(browserWindow), "Fetcher", 384, 192, 64, 64, PTROF(browserMenuItemsRoot), PTROF(browserIcons));
DrawBrowserWindow(); DrawBrowserWindow();
WHILE browserRunning DO WHILE browserRunning DO
@ -53,6 +54,22 @@ MODULE Browser;
END; END;
handle_widget_click(PTROF(browserWindow), eventArgs[1], eventArgs[2]); handle_widget_click(PTROF(browserWindow), eventArgs[1], eventArgs[2]);
(* menu bar click event *)
ELSIF eventArgs[0] = PTROF(EVENT_TYPE_MENU_BAR_CLICK) THEN
menu_bar_click_event(PTROF(browserMenuItemsRoot));
(* menu update event *)
ELSIF eventArgs[0] = PTROF(EVENT_TYPE_MENU_UPDATE) THEN
menu_update_event();
(* menu click event *)
ELSIF eventArgs[0] = PTROF(EVENT_TYPE_MENU_CLICK) THEN
MenuClickEvent(eventArgs[2], eventArgs[3]);
(* menu ack event *)
ELSIF eventArgs[0] = PTROF(EVENT_TYPE_MENU_ACK) THEN
close_menu(PTROF(browserMenuItemsRoot));
(* button click event *) (* button click event *)
ELSIF eventArgs[0] = PTROF(EVENT_TYPE_BUTTON_CLICK) THEN ELSIF eventArgs[0] = PTROF(EVENT_TYPE_BUTTON_CLICK) THEN
HandleIconClick(eventArgs[1]); HandleIconClick(eventArgs[1]);
@ -71,10 +88,26 @@ MODULE Browser;
(* previous page button *) (* previous page button *)
DecrementBrowserPage(); DecrementBrowserPage();
ELSE ELSE
(* an icon was clicked! *)
LaunchFromIcon(buttonId); LaunchFromIcon(buttonId);
END; END;
END; END;
PROCEDURE MenuClickEvent(rootIndex, itemIndex: INT;);
BEGIN
IF rootIndex = 0 THEN
(* System menu *)
IF itemIndex = 0 THEN
(* About fox32os *)
(* DIRTY HACK WARNING!!! *)
close_menu(PTROF(browserMenuItemsRoot));
AboutMain();
END;
END;
END;
PROCEDURE DrawBrowserWindow(); PROCEDURE DrawBrowserWindow();
BEGIN BEGIN
fill_window(0FFFFFFFFH, PTROF(browserWindow)); fill_window(0FFFFFFFFH, PTROF(browserWindow));

View File

@ -77,6 +77,16 @@ browserFile9: data.fill 0, 13
browserFile10: data.fill 0, 13 browserFile10: data.fill 0, 13
browserFile11: data.fill 0, 13 browserFile11: data.fill 0, 13
browserMenuItemsRoot:
data.8 1 ; number of menus
data.32 menu_items_system_list data.32 menu_items_system_name ; pointer to menu list, pointer to menu name
menu_items_system_name:
data.8 6 data.strz "System" ; text length, text, null-terminator
menu_items_system_list:
data.8 1 ; number of items
data.8 7 ; menu width (usually longest item + 2)
data.8 5 data.strz "About" ; text length, text, null-terminator
diskIcon: diskIcon:
#include "icons/disk.inc" #include "icons/disk.inc"