From bbf6c15b971dd1e927c474d1832a4a8373beacda Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Sun, 10 Nov 2024 00:48:55 +0000 Subject: [PATCH 1/3] Add joypad images (#156) ## Description Taken from https://github.com/n64brew/N64brew-GameJam2024-Template/ (MIT) Also improves the assets by adding them into sub-directories. ## Motivation and Context Will allow use in the menu to improve navigation/context. ## How Has This Been Tested? ## Screenshots ## Types of changes - [x] Improvement (non-breaking change that adds a new feature) - [ ] Bug fix (fixes an issue) - [ ] Breaking change (breaking change) - [ ] Documentation Improvement - [x] Config and build (change in the configuration and build system, has no impact on code or features) ## Checklist: - [ ] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. Signed-off-by: GITHUB_USER --- .gitignore | 1 + Makefile | 35 ++++++++++++++++++++++-- assets/{ => fonts}/FiraMonoBold.ttf | Bin assets/images/joypad/joypad_a.png | Bin 0 -> 653 bytes assets/images/joypad/joypad_b.png | Bin 0 -> 649 bytes assets/images/joypad/joypad_c_down.png | Bin 0 -> 666 bytes assets/images/joypad/joypad_c_left.png | Bin 0 -> 707 bytes assets/images/joypad/joypad_c_right.png | Bin 0 -> 715 bytes assets/images/joypad/joypad_c_up.png | Bin 0 -> 711 bytes assets/images/joypad/joypad_d_down.png | Bin 0 -> 419 bytes assets/images/joypad/joypad_d_left.png | Bin 0 -> 423 bytes assets/images/joypad/joypad_d_right.png | Bin 0 -> 419 bytes assets/images/joypad/joypad_d_up.png | Bin 0 -> 440 bytes assets/images/joypad/joypad_l.png | Bin 0 -> 376 bytes assets/images/joypad/joypad_r.png | Bin 0 -> 424 bytes assets/images/joypad/joypad_start.png | Bin 0 -> 672 bytes assets/images/joypad/joypad_z.png | Bin 0 -> 387 bytes assets/{ => sounds}/back.wav | Bin assets/{ => sounds}/cursorsound.wav | Bin assets/{ => sounds}/enter.wav | Bin assets/{ => sounds}/error.wav | Bin assets/{ => sounds}/settings.wav | Bin 22 files changed, 33 insertions(+), 3 deletions(-) rename assets/{ => fonts}/FiraMonoBold.ttf (100%) create mode 100644 assets/images/joypad/joypad_a.png create mode 100644 assets/images/joypad/joypad_b.png create mode 100644 assets/images/joypad/joypad_c_down.png create mode 100644 assets/images/joypad/joypad_c_left.png create mode 100644 assets/images/joypad/joypad_c_right.png create mode 100644 assets/images/joypad/joypad_c_up.png create mode 100644 assets/images/joypad/joypad_d_down.png create mode 100644 assets/images/joypad/joypad_d_left.png create mode 100644 assets/images/joypad/joypad_d_right.png create mode 100644 assets/images/joypad/joypad_d_up.png create mode 100644 assets/images/joypad/joypad_l.png create mode 100644 assets/images/joypad/joypad_r.png create mode 100644 assets/images/joypad/joypad_start.png create mode 100644 assets/images/joypad/joypad_z.png rename assets/{ => sounds}/back.wav (100%) rename assets/{ => sounds}/cursorsound.wav (100%) rename assets/{ => sounds}/enter.wav (100%) rename assets/{ => sounds}/error.wav (100%) rename assets/{ => sounds}/settings.wav (100%) diff --git a/.gitignore b/.gitignore index 9b9f4205..dcc08de7 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ # Ignore generated files in the libdragon FS /filesystem/FiraMonoBold.font64 /filesystem/*.wav64 +/filesystem/*.sprite # Ignore external development tools /tools/* diff --git a/Makefile b/Makefile index eac1f424..d8cf4edf 100644 --- a/Makefile +++ b/Makefile @@ -85,6 +85,30 @@ SOUNDS = \ error.wav \ settings.wav +JOYPAD_IMAGES = \ + joypad_a.png \ + joypad_b.png \ + joypad_c_down.png \ + joypad_c_left.png \ + joypad_c_right.png \ + joypad_c_up.png \ + joypad_d_down.png \ + joypad_d_left.png \ + joypad_d_right.png \ + joypad_d_up.png \ + joypad_l.png \ + joypad_r.png \ + joypad_start.png \ + joypad_z.png +# joypad_j_east.png \ +# joypad_j_north.png \ +# joypad_j_northeast.png \ +# joypad_j_northwest.png \ +# joypad_j_south.png \ +# joypad_j_southeast.png \ +# joypad_j_southwest.png \ +# joypad_j_west.png \ + OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o,$(basename $(SRCS)))) MINIZ_OBJS = $(filter $(BUILD_DIR)/libs/miniz/%.o,$(OBJS)) SPNG_OBJS = $(filter $(BUILD_DIR)/libs/libspng/%.o,$(OBJS)) @@ -92,7 +116,8 @@ DEPS = $(OBJS:.o=.d) FILESYSTEM = \ $(addprefix $(FILESYSTEM_DIR)/, $(notdir $(FONTS:%.ttf=%.font64))) \ - $(addprefix $(FILESYSTEM_DIR)/, $(notdir $(SOUNDS:%.wav=%.wav64))) + $(addprefix $(FILESYSTEM_DIR)/, $(notdir $(SOUNDS:%.wav=%.wav64))) \ + $(addprefix $(FILESYSTEM_DIR)/, $(notdir $(JOYPAD_IMAGES:%.png=%.sprite))) $(MINIZ_OBJS): N64_CFLAGS+=-DMINIZ_NO_TIME -fcompare-debug-second $(SPNG_OBJS): N64_CFLAGS+=-isystem $(SOURCE_DIR)/libs/miniz -DSPNG_USE_MINIZ -fcompare-debug-second @@ -101,14 +126,18 @@ $(FILESYSTEM_DIR)/%.wav64: AUDIOCONV_FLAGS=--wav-compress 1 $(@info $(shell mkdir -p ./$(FILESYSTEM_DIR) &> /dev/null)) -$(FILESYSTEM_DIR)/%.font64: $(ASSETS_DIR)/%.ttf +$(FILESYSTEM_DIR)/%.font64: $(ASSETS_DIR)/fonts/%.ttf @echo " [FONT] $@" @$(N64_MKFONT) $(MKFONT_FLAGS) -o $(FILESYSTEM_DIR) "$<" -$(FILESYSTEM_DIR)/%.wav64: $(ASSETS_DIR)/%.wav +$(FILESYSTEM_DIR)/%.wav64: $(ASSETS_DIR)/sounds/%.wav @echo " [AUDIO] $@" @$(N64_AUDIOCONV) $(AUDIOCONV_FLAGS) -o $(FILESYSTEM_DIR) "$<" +$(FILESYSTEM_DIR)/%.sprite: $(ASSETS_DIR)/images/joypad/%.png + @echo " [SPRITE] $@" + @$(N64_MKSPRITE) $(MKSPRITE_FLAGS) -o $(dir $@) "$<" + $(BUILD_DIR)/$(PROJECT_NAME).dfs: $(FILESYSTEM) $(BUILD_DIR)/menu/views/credits.o: .FORCE diff --git a/assets/FiraMonoBold.ttf b/assets/fonts/FiraMonoBold.ttf similarity index 100% rename from assets/FiraMonoBold.ttf rename to assets/fonts/FiraMonoBold.ttf diff --git a/assets/images/joypad/joypad_a.png b/assets/images/joypad/joypad_a.png new file mode 100644 index 0000000000000000000000000000000000000000..9e6e6493a13daaa26db6f7e330dbd78ae4cc62db GIT binary patch literal 653 zcmV;80&@L{P)@y)rp$;Mubp*{q=+-boVW`By)VZpJ)TN)Gb3Xx6yS8gT z0P4V-#1bKC;-T~A4DNPV!h6W^f&j%`u__k(9fA6#&daapy8H0GPHzZrxeD zPxJ0J0H}(yI+sej4=w|bO6-igpybxd8qGd_UbwwjQMFS(jtBU7_yGd|ww=0AV%d%z ze6M9yqFb{>PYw%=a}aVBEC?swg6JkRVwO}zGwjgFe(hYC2Y%T3QGY30TL&rtu!gr>ukBSu;71dO{tKVf zUc47gZv{BBOf>Iq)2zFYyIFCFZvHp3->kMe?c-OX>8*?{(`c03TA3#7b&Z%MRWm4X n`r2{CKePU?4cXc{814T9ih=Y)U@uCn00000NkvXXu0mjfV)P$* literal 0 HcmV?d00001 diff --git a/assets/images/joypad/joypad_b.png b/assets/images/joypad/joypad_b.png new file mode 100644 index 0000000000000000000000000000000000000000..e5874cfff3bd9b22aeaeca708b1d544099bf19f3 GIT binary patch literal 649 zcmV;40(Sk0P)EmEuLgoa}NqN%VJ43W-R*>ZvCs@ z0f3TSYdu@e-4{!O$B~8_D5!ygj`duVOgXnf_6k*IKFU8^-dwIxPSO7spy#v^e(%F; zdf+ApOHL1!wnV1)@#iAtX}-o&LlWTxMmC9j^%huyBJRgCQ*gn-1g}t%WSP+mIf&77 zx&Q$7kCjk^WjKJbVRfXS)bE$)>|q!gn(9z_W6?|lxyk}SfUq0R)yD(nQR&GKvM)yu z(f#59F~AHuQ!E1s6-4h?bVpq2D1MS%$=-kl2n84?Fcwls-An<5Of_h}X}UkI{ijqP zx)+|^c^$aE&vN%3GwxF=WSp& zc7Ta8ndRcKS+(zEB1dZryElK6hROc4KF(Ors!sg{qn1`%Lf(O%CfE50s~T j`QB^G1AWxG9OeH4Nfh#H*|FL)00000NkvXXu0mjfw>}j^ literal 0 HcmV?d00001 diff --git a/assets/images/joypad/joypad_c_down.png b/assets/images/joypad/joypad_c_down.png new file mode 100644 index 0000000000000000000000000000000000000000..773e13914c0b1b7d50d9ec77a5c91e2195601855 GIT binary patch literal 666 zcmV;L0%iS)P)UMk%I5uh$*b8}; z`1sFMz}&+*0Dz`1#4W2`p^_wJt}d*+yoBzF1;*HoW>FMTep@#<}-H~ZppI0~7ApwBXlhZei z`ayjhqG>ubU7s*F4(j`7o&Gv7HcXLNUrUWpp@U?NL`2R;_#L5Rk*h1zaQ?e28D>p}XNVth_BllS-JnRn)8eBVc_UOphV zLp{=xB#M230LKA9t>(J6V;`1EmAPB@ofob3Ox<94fe9-SWjl6i@U*6lu!1188B9X7>Zvg=J{2`gSc;Vb|H~8St!t3`Npp^n-u?k80 zdo5M%#ZYYM%*rB}=Hwpfk)|aAtzgBbc=K)p*@G;?#70Q0H;if2Xo&=yNvD@Mk%-ZH z!#vN!$2AjQzV0E&mmy0Xk(xXNL4ZI=KgaPr2LSs&vUvO9GkB&1Me@4#qEkH2b1aUZ zu|Fc?>UbPsi9Hcu7^ZFS`2g#>t_uLcpooN~VQT6I;_>)@C8)Vom$e=HkW$(>lq3nd zp2Ebn2`Gx%5uv$s90!y-S+-oR%9D(NdS$yZ%lN*J z)hFs+Dy7Fy`bd;gY;A4g(nu0SB*^FUST~Gs*Y6b0vj9-cS;@6e>!m^=-_<}61dNT1 zH(?;{!PwbE;)G$^+3_-&%)XVgM%#v|RV#~RIuw!~6M;l|p67f3 pZnf$#7JVka}1WO7|-+oX-Ya2NM*&T~FEhj7l(uV>4l z*)U^^5k;0oNg@CcbOY|TJ+JkvHFxcnf3M%4>;qO8NJ34-cJxs_Vi*P}r2}B!_faa9 zP^tWInzd$XW}aIIfYk+(P?NErrkN9CF%7*QhbRgdrbeTVe7+DgYxc;@Jhub@P!q8o z)69vQ7Dvr$;L*w&HcQ(>0h$(vY34*Vsg?mioD46`rp8iN(&;e*0G#(w{G)^|L9`WA2AeL@iQ005LyC^A(9iH67kdhiDT2uXk%c2L>< zf`=<>_*Sk00HlyaB=F+_{}PK3OrAZ1lS%a;o7C-ecz<3(hLiwcbo4Z`*(?}i2exjf z!zHind%o{SjxNr=qR}WanJjc&AF%tr53lXJg41&5wzi6gjr=WuQi@C_i|Ogh$AST% zv{i)bx_1cY9BU7>J=4rFO^c)LwXs>;z{JFbW9z)Hdfmc$etqxK^+r?xfM(53<@1H0 z(WpaKWK2z6{7-Nlg~EDZTXq^adQ3^Rtm`^6jPt{fsaQm{Qr)vHJ3Vkr{d#_v-iR=^ xq{vi}LJ|Q8x}6Sp+rHm0Kh%vC7ZEtrAlS=(I8t7`h_as)l-2)S|gMCmDt^QN4$*?QU`V%2ieTl zK`xh{vkF#!--z$j0B2!st|xUXrD;*A8rt6d1>f@#zj?I=Di%%GNE?gRp>?ls#CJph zh_pr~8^fOGVSeE&=8X+_o>v2CT2xB)q;7{>!V>@>PL0!~9@Fmx!vOGUaSM`Af-IEq zabdHr9Zic$v6$XFJx064WCpz2IkUAt% zm9{qyY-V;Did3q-Rk@7W_bYWCLI|irJ49JJ`>Lw)e@qn3L&$-KWC=Jb9O8GrPzRAN z$(Kbm=G3lY%t>G#pd7B|M?W^xj0G^V~5p#*ocq^SONP-ATb3s5_>hrpIWP8d8U- tLOW#nY)3ffWyV;xT&avc9Aq0o|6k6t4$`cRcX9v#002ovPDHLkV1gs$K0yEg literal 0 HcmV?d00001 diff --git a/assets/images/joypad/joypad_d_down.png b/assets/images/joypad/joypad_d_down.png new file mode 100644 index 0000000000000000000000000000000000000000..4223ec3b6635002821e2a3ac4272e71b738580ea GIT binary patch literal 419 zcmV;U0bKrxP)0{F&LM&1UnxUawyH9eB!O-BW|~V3f&jDG z%z$0jHS7ZraQ4(R@C~a=E<5i^T%I?;G%?!Jw2kDa2#h477@1Vx;`~clizO_0HP>@hz!C_(?Dze!*yMM9FNCx=mjz} zEXy+TZQJ5-IQ&*s^-dy!)oS(TdEV!AI(>QeH$+6V)~B{@x4Yf$>kq0;VK#^u4$uGq N002ovPDHLkV1oC?vg`l= literal 0 HcmV?d00001 diff --git a/assets/images/joypad/joypad_d_left.png b/assets/images/joypad/joypad_d_left.png new file mode 100644 index 0000000000000000000000000000000000000000..fb4676037387c3b74da86950f8a204e6ea581002 GIT binary patch literal 423 zcmV;Y0a*TtP)jV|m&?!rW2~DZHcf*p%V3Ow5CT%lp}-iiZCjkrXEaR% zDJ5>%{I)+3AR^>>j;gA_IfqhecD0^BUDwF63;;&0PT`)OWmyP<09xzC-D;KHx}Y#0c_hw9LEU55OWO`0EV(ZCT_P|Y&IJdMKQj@ z^?Lp6y2&m909LCNeBU4a9d3+yKAlb<#+X@=NtZ-~G)-g6vfh+ZA!c$J!xug1R#QB$ RSQr2R002ovPDHLkV1nh5r?~(C literal 0 HcmV?d00001 diff --git a/assets/images/joypad/joypad_d_right.png b/assets/images/joypad/joypad_d_right.png new file mode 100644 index 0000000000000000000000000000000000000000..d9f3fd939451319905f58b8e579a785144aeea57 GIT binary patch literal 419 zcmV;U0bKrxP)V$dKR#kN@%kncxl8n~tbvF}$x~{R^ZhyK{98naZD2gdgH@X4<2q8d3$g&KZ%?4Ff zjp_yfBI>=F8Tb1gaU5g6-w*EdG(k_KX^>K)C<=sOh|A^j=_m93S2_5|ID^rPQ%$ny)lX(?1Cw7Y%|Sbcsn~I-P4! zK~y-6#Z$XZ#4r%twKs`lDfoy5DRNDm0x6}1#5I&iP|@&fl>7o6d`D7KrOgjmc_^l! zBsmTRiD`FcS39$d-h0>rwn_aL4d_&2Q4~8Ox)nk^20>79&f{Si-f+zWW6YJ5@{Wk^ ziD)mS)M=VtD5at(iU0thX_^lL06;`umgS9<@`;G9gCNL^F*~jGWs)So*z%@~v5=~& zI#_F8vMk$ctDaxbb zzVD%JTbQP4l|$b9d8xoThdj@}rmUne&+|;qx!1a`AH4U!G6E52=iK}1A)Si9Q=JmdoX}wf25I z9w$En42Q#)Uaxlq0LBt z3`(i@EX$IzEZ?lPk7=4-P9~EFX0EmZX0sWRBmohj-EPD8eE@*g8cL}&j^n8@=4|T_ zSF05~&jSGDdA`T0000OaVYn zl$xUW+Sht_kLa{K&u#%5jCoBd51V25Y_(pm`HnLNzA6fIk|c@K^d#1L^N1+F18gwn zMN+q+qXoVr-G(|HAV64TZ)|mBu{4ENY;Sh~5 ztaa10&8LNEG0rhNHHEA*LM*DmIw}G z5S)V%!Q~uTQ6L+QKC{=r^77o=@!I_S!%4pp08TD1lTS(Vg6|QX##(L5~TeYIY%NiiPG?7B=pzxVs^ z;w;-5D^poJj4cI9wWZ@M`kX7^`r2kRI{%~f?mp33dHx>>TMCI3kxJ?S0000Z{Bp?OUt%xgF{)Cmr}}CDdiOroxy{(_G?*|k6{=d>bm}PeB_IylrL3P-AO6& z6SUU1N~vc6_l_f9z&XDTH3LABB;cGEK6hZi7~{ci*FYqK2LHk74WdwCT~|!g1OQ0W z6pXRIC9u|_?|Zau3;(VBIsxY#S(d?C3!?C(yF2K*4tbvMNx}y6JVR>@A;j(oK?5Q} z6h&y72G-i3!NCr;Z8PpHgg{XgM-9H_D1kBNO=}&zZJuWsW8Q-a#&LX7N?pWpd_zR% he$9R7aU36g{u?J6XzyjDz4rhB002ovPDHLkV1n9sofZH9 literal 0 HcmV?d00001 diff --git a/assets/back.wav b/assets/sounds/back.wav similarity index 100% rename from assets/back.wav rename to assets/sounds/back.wav diff --git a/assets/cursorsound.wav b/assets/sounds/cursorsound.wav similarity index 100% rename from assets/cursorsound.wav rename to assets/sounds/cursorsound.wav diff --git a/assets/enter.wav b/assets/sounds/enter.wav similarity index 100% rename from assets/enter.wav rename to assets/sounds/enter.wav diff --git a/assets/error.wav b/assets/sounds/error.wav similarity index 100% rename from assets/error.wav rename to assets/sounds/error.wav diff --git a/assets/settings.wav b/assets/sounds/settings.wav similarity index 100% rename from assets/settings.wav rename to assets/sounds/settings.wav From 0d30a6f3b927059ef6c4e5a485e95db4e63f577d Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 11 Nov 2024 12:11:30 +0000 Subject: [PATCH 2/3] Update libdragon --- libdragon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdragon b/libdragon index 52950162..0c4e3888 160000 --- a/libdragon +++ b/libdragon @@ -1 +1 @@ -Subproject commit 5295016230d657cd6c7fce5b6ed4a342538e09f5 +Subproject commit 0c4e388851cabab52f421bff5e75e9dc3ab36c72 From 96506edbc7ef135c2cb01eb5ada8ab405490dc08 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 11 Nov 2024 17:29:39 +0000 Subject: [PATCH 3/3] Rename components to ui_components (#160) Renames `components` to `ui_components` Makes the source more clear as to its functionality - [x] Improvement (non-breaking change that adds a new feature) - [ ] Bug fix (fixes an issue) - [ ] Breaking change (breaking change) - [ ] Documentation Improvement - [ ] Config and build (change in the configuration and build system, has no impact on code or features) - [ ] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. Signed-off-by: GITHUB_USER --- Makefile | 10 +-- src/menu/menu.c | 4 +- src/menu/{components.h => ui_components.h} | 64 +++++++++---------- .../background.c | 10 +-- .../{components => ui_components}/boxart.c | 10 +-- .../{components => ui_components}/common.c | 56 ++++++++-------- .../{components => ui_components}/constants.h | 0 .../context_menu.c | 16 ++--- .../{components => ui_components}/file_list.c | 10 +-- src/menu/views/browser.c | 28 ++++---- src/menu/views/credits.c | 10 +-- src/menu/views/error.c | 6 +- src/menu/views/fault.c | 2 +- src/menu/views/file_info.c | 10 +-- src/menu/views/flashcart_info.c | 10 +-- src/menu/views/image_viewer.c | 10 +-- src/menu/views/load_disk.c | 24 +++---- src/menu/views/load_emulator.c | 16 ++--- src/menu/views/load_rom.c | 34 +++++----- src/menu/views/music_player.c | 12 ++-- src/menu/views/rtc.c | 18 +++--- src/menu/views/settings_editor.c | 18 +++--- src/menu/views/system_info.c | 10 +-- src/menu/views/text_viewer.c | 12 ++-- src/menu/views/views.h | 2 +- 25 files changed, 198 insertions(+), 204 deletions(-) rename src/menu/{components.h => ui_components.h} (75%) rename src/menu/{components => ui_components}/background.c (95%) rename src/menu/{components => ui_components}/boxart.c (93%) rename src/menu/{components => ui_components}/common.c (70%) rename src/menu/{components => ui_components}/constants.h (100%) rename src/menu/{components => ui_components}/context_menu.c (87%) rename src/menu/{components => ui_components}/file_list.c (95%) diff --git a/Makefile b/Makefile index d8cf4edf..052b3c44 100644 --- a/Makefile +++ b/Makefile @@ -41,11 +41,6 @@ SRCS = \ libs/miniz/miniz.c \ menu/actions.c \ menu/cart_load.c \ - menu/components/background.c \ - menu/components/boxart.c \ - menu/components/common.c \ - menu/components/context_menu.c \ - menu/components/file_list.c \ menu/disk_info.c \ menu/fonts.c \ menu/hdmi.c \ @@ -56,6 +51,11 @@ SRCS = \ menu/rom_info.c \ menu/settings.c \ menu/sound.c \ + menu/ui_components/background.c \ + menu/ui_components/boxart.c \ + menu/ui_components/common.c \ + menu/ui_components/context_menu.c \ + menu/ui_components/file_list.c \ menu/usb_comm.c \ menu/views/browser.c \ menu/views/credits.c \ diff --git a/src/menu/menu.c b/src/menu/menu.c index 5e2b2168..91a51a09 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -87,7 +87,7 @@ static void menu_init (boot_params_t *boot_params) { directory_create(path_get(path)); path_push(path, BACKGROUND_CACHE_FILE); - component_background_init(path_get(path)); + ui_components_background_init(path_get(path)); path_free(path); @@ -103,7 +103,7 @@ static void menu_init (boot_params_t *boot_params) { static void menu_deinit (menu_t *menu) { hdmi_send_game_id(menu->boot_params); - component_background_free(); + ui_components_background_free(); path_free(menu->load.disk_path); path_free(menu->load.rom_path); diff --git a/src/menu/components.h b/src/menu/ui_components.h similarity index 75% rename from src/menu/components.h rename to src/menu/ui_components.h index f15a6ba5..f0dc6060 100644 --- a/src/menu/components.h +++ b/src/menu/ui_components.h @@ -1,24 +1,20 @@ /** - * @file components.h + * @file ui_components.h * @brief Menu Graphical User Interface Components * @ingroup menu */ -#ifndef COMPONENTS_H__ -#define COMPONENTS_H__ +#ifndef UI_COMPONENTS_H__ +#define UI_COMPONENTS_H__ #include #include "menu_state.h" -/** - * @addtogroup menu_ui_components - * @{ - */ /** * @brief File image Enumeration. * - * Enumeration for different types of file images used in the GUI. + * Enumeration for different types of file images used in the user interface. */ typedef enum { IMAGE_BOXART_FRONT, /**< Boxart image from the front */ @@ -42,7 +38,7 @@ typedef enum { * @param y1 Ending y-coordinate. * @param color Color of the box. */ -void component_box_draw(int x0, int y0, int x1, int y1, color_t color); +void ui_components_box_draw(int x0, int y0, int x1, int y1, color_t color); /** * @brief Draw a border component. @@ -52,12 +48,12 @@ void component_box_draw(int x0, int y0, int x1, int y1, color_t color); * @param x1 Ending x-coordinate. * @param y1 Ending y-coordinate. */ -void component_border_draw(int x0, int y0, int x1, int y1); +void ui_components_border_draw(int x0, int y0, int x1, int y1); /** * @brief Draw the layout component. */ -void component_layout_draw(void); +void ui_components_layout_draw(void); /** * @brief Draw a progress bar component. @@ -68,21 +64,21 @@ void component_layout_draw(void); * @param y1 Ending y-coordinate. * @param progress Progress value (0.0 to 1.0). */ -void component_progressbar_draw(int x0, int y0, int x1, int y1, float progress); +void ui_components_progressbar_draw(int x0, int y0, int x1, int y1, float progress); /** * @brief Draw a seek bar component. * * @param progress Progress value (0.0 to 1.0). */ -void component_seekbar_draw(float progress); +void ui_components_seekbar_draw(float progress); /** * @brief Draw a loader component. * * @param position Position value (0.0 to 1.0). */ -void component_loader_draw(float position); +void ui_components_loader_draw(float position); /** * @brief Draw a scrollbar component. @@ -95,7 +91,7 @@ void component_loader_draw(float position); * @param items Total number of items. * @param visible_items Number of visible items. */ -void component_scrollbar_draw(int x, int y, int width, int height, int position, int items, int visible_items); +void ui_components_scrollbar_draw(int x, int y, int width, int height, int position, int items, int visible_items); /** * @brief Draw a list scrollbar component. @@ -104,7 +100,7 @@ void component_scrollbar_draw(int x, int y, int width, int height, int position, * @param items Total number of items. * @param visible_items Number of visible items. */ -void component_list_scrollbar_draw(int position, int items, int visible_items); +void ui_components_list_scrollbar_draw(int position, int items, int visible_items); /** * @brief Draw a dialog component. @@ -112,7 +108,7 @@ void component_list_scrollbar_draw(int position, int items, int visible_items); * @param width Width of the dialog. * @param height Height of the dialog. */ -void component_dialog_draw(int width, int height); +void ui_components_dialog_draw(int width, int height); /** * @brief Draw a message box component. @@ -120,7 +116,7 @@ void component_dialog_draw(int width, int height); * @param fmt Format string for the message. * @param ... Additional arguments for the format string. */ -void component_messagebox_draw(char *fmt, ...); +void ui_components_messagebox_draw(char *fmt, ...); /** * @brief Draw the main text component. @@ -130,7 +126,7 @@ void component_messagebox_draw(char *fmt, ...); * @param fmt Format string for the text. * @param ... Additional arguments for the format string. */ -void component_main_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...); +void ui_components_main_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...); /** * @brief Draw the actions bar text component. @@ -140,31 +136,31 @@ void component_main_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fm * @param fmt Format string for the text. * @param ... Additional arguments for the format string. */ -void component_actions_bar_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...); +void ui_components_actions_bar_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...); /** * @brief Initialize the background component. * * @param cache_location Location of the cache. */ -void component_background_init(char *cache_location); +void ui_components_background_init(char *cache_location); /** * @brief Free the background component resources. */ -void component_background_free(void); +void ui_components_background_free(void); /** * @brief Replace the background image. * * @param image New background image. */ -void component_background_replace_image(surface_t *image); +void ui_components_background_replace_image(surface_t *image); /** * @brief Draw the background component. */ -void component_background_draw(void); +void ui_components_background_draw(void); /** * @brief Draw the file list component. @@ -173,7 +169,7 @@ void component_background_draw(void); * @param entries Number of entries. * @param selected Index of the selected entry. */ -void component_file_list_draw(entry_t *list, int entries, int selected); +void ui_components_file_list_draw(entry_t *list, int entries, int selected); /** * @brief Context menu structure. @@ -199,14 +195,14 @@ typedef struct component_context_menu { * * @param cm Pointer to the context menu structure. */ -void component_context_menu_init(component_context_menu_t *cm); +void ui_components_context_menu_init(component_context_menu_t *cm); /** * @brief Show the context menu component. * * @param cm Pointer to the context menu structure. */ -void component_context_menu_show(component_context_menu_t *cm); +void ui_components_context_menu_show(component_context_menu_t *cm); /** * @brief Process the context menu component. @@ -215,14 +211,14 @@ void component_context_menu_show(component_context_menu_t *cm); * @param cm Pointer to the context menu structure. * @return True if the context menu was processed, false otherwise. */ -bool component_context_menu_process(menu_t *menu, component_context_menu_t *cm); +bool ui_components_context_menu_process(menu_t *menu, component_context_menu_t *cm); /** * @brief Draw the context menu component. * * @param cm Pointer to the context menu structure. */ -void component_context_menu_draw(component_context_menu_t *cm); +void ui_components_context_menu_draw(component_context_menu_t *cm); /** * @brief Box Art Structure. @@ -240,22 +236,20 @@ typedef struct { * @param current_image_view Current image view type. * @return Pointer to the initialized box art component. */ -component_boxart_t *component_boxart_init(const char *storage_prefix, char *game_code, file_image_type_t current_image_view); +component_boxart_t *ui_components_boxart_init(const char *storage_prefix, char *game_code, file_image_type_t current_image_view); /** * @brief Free the box art component resources. * * @param b Pointer to the box art component. */ -void component_boxart_free(component_boxart_t *b); +void ui_components_boxart_free(component_boxart_t *b); /** * @brief Draw the box art component. * * @param b Pointer to the box art component. */ -void component_boxart_draw(component_boxart_t *b); +void ui_components_boxart_draw(component_boxart_t *b); -/** @} */ /* menu_ui_components */ - -#endif /* COMPONENTS_H__ */ +#endif /* UI_COMPONENTS_H__ */ diff --git a/src/menu/components/background.c b/src/menu/ui_components/background.c similarity index 95% rename from src/menu/components/background.c rename to src/menu/ui_components/background.c index 525fb0c8..548bc0f0 100644 --- a/src/menu/components/background.c +++ b/src/menu/ui_components/background.c @@ -1,7 +1,7 @@ #include #include -#include "../components.h" +#include "../ui_components.h" #include "constants.h" #include "utils/fs.h" @@ -157,7 +157,7 @@ static void display_list_free (void *arg) { } -void component_background_init (char *cache_location) { +void ui_components_background_init (char *cache_location) { if (!background) { background = calloc(1, sizeof(component_background_t)); background->cache_location = strdup(cache_location); @@ -166,7 +166,7 @@ void component_background_init (char *cache_location) { } } -void component_background_free (void) { +void ui_components_background_free (void) { if (background) { if (background->image) { surface_free(background->image); @@ -185,7 +185,7 @@ void component_background_free (void) { } } -void component_background_replace_image (surface_t *image) { +void ui_components_background_replace_image (surface_t *image) { if (!background) { return; } @@ -206,7 +206,7 @@ void component_background_replace_image (surface_t *image) { prepare_background(background); } -void component_background_draw (void) { +void ui_components_background_draw (void) { if (background && background->image_display_list) { rspq_block_run(background->image_display_list); } else { diff --git a/src/menu/components/boxart.c b/src/menu/ui_components/boxart.c similarity index 93% rename from src/menu/components/boxart.c rename to src/menu/ui_components/boxart.c index d663230a..16070523 100644 --- a/src/menu/components/boxart.c +++ b/src/menu/ui_components/boxart.c @@ -1,6 +1,6 @@ #include -#include "../components.h" +#include "../ui_components.h" #include "../path.h" #include "../png_decoder.h" #include "constants.h" @@ -17,7 +17,7 @@ static void png_decoder_callback (png_err_t err, surface_t *decoded_image, void } -component_boxart_t *component_boxart_init (const char *storage_prefix, char *game_code, file_image_type_t current_image_view) { +component_boxart_t *ui_components_boxart_init (const char *storage_prefix, char *game_code, file_image_type_t current_image_view) { component_boxart_t *b; char boxart_id_path[8]; @@ -120,7 +120,7 @@ component_boxart_t *component_boxart_init (const char *storage_prefix, char *gam return NULL; } -void component_boxart_free (component_boxart_t *b) { +void ui_components_boxart_free (component_boxart_t *b) { if (b) { if (b->loading) { png_decoder_abort(); @@ -133,7 +133,7 @@ void component_boxart_free (component_boxart_t *b) { } } -void component_boxart_draw (component_boxart_t *b) { +void ui_components_boxart_draw (component_boxart_t *b) { int box_x = BOXART_X; int box_y = BOXART_Y; @@ -150,7 +150,7 @@ void component_boxart_draw (component_boxart_t *b) { rdpq_tex_blit(b->image, box_x, box_y, NULL); rdpq_mode_pop(); } else { - component_box_draw( + ui_components_box_draw( BOXART_X, BOXART_Y, BOXART_X + BOXART_WIDTH, diff --git a/src/menu/components/common.c b/src/menu/ui_components/common.c similarity index 70% rename from src/menu/components/common.c rename to src/menu/ui_components/common.c index 29a97ada..dec31885 100644 --- a/src/menu/components/common.c +++ b/src/menu/ui_components/common.c @@ -1,11 +1,11 @@ #include -#include "../components.h" +#include "../ui_components.h" #include "../fonts.h" #include "constants.h" -void component_box_draw (int x0, int y0, int x1, int y1, color_t color) { +void ui_components_box_draw (int x0, int y0, int x1, int y1, color_t color) { rdpq_mode_push(); rdpq_set_mode_fill(color); @@ -13,7 +13,7 @@ void component_box_draw (int x0, int y0, int x1, int y1, color_t color) { rdpq_mode_pop(); } -void component_border_draw (int x0, int y0, int x1, int y1) { +void ui_components_border_draw (int x0, int y0, int x1, int y1) { rdpq_mode_push(); rdpq_set_mode_fill(BORDER_COLOR); @@ -25,14 +25,14 @@ void component_border_draw (int x0, int y0, int x1, int y1) { rdpq_mode_pop(); } -void component_layout_draw (void) { - component_border_draw( +void ui_components_layout_draw (void) { + ui_components_border_draw( VISIBLE_AREA_X0, VISIBLE_AREA_Y0, VISIBLE_AREA_X1, VISIBLE_AREA_Y1 ); - component_box_draw( + ui_components_box_draw( VISIBLE_AREA_X0, LAYOUT_ACTIONS_SEPARATOR_Y, VISIBLE_AREA_X1, @@ -41,47 +41,47 @@ void component_layout_draw (void) { ); } -void component_progressbar_draw (int x0, int y0, int x1, int y1, float progress) { +void ui_components_progressbar_draw (int x0, int y0, int x1, int y1, float progress) { float progress_width = progress * (x1 - x0); - component_box_draw(x0, y0, x0 + progress_width, y1, PROGRESSBAR_DONE_COLOR); - component_box_draw(x0 + progress_width, y0, x1, y1, PROGRESSBAR_BG_COLOR); + ui_components_box_draw(x0, y0, x0 + progress_width, y1, PROGRESSBAR_DONE_COLOR); + ui_components_box_draw(x0 + progress_width, y0, x1, y1, PROGRESSBAR_BG_COLOR); } -void component_seekbar_draw (float position) { +void ui_components_seekbar_draw (float position) { int x0 = SEEKBAR_X; int y0 = SEEKBAR_Y; int x1 = SEEKBAR_X + SEEKBAR_WIDTH; int y1 = SEEKBAR_Y + SEEKBAR_HEIGHT; - component_border_draw(x0, y0, x1, y1); - component_progressbar_draw(x0, y0, x1, y1, position); + ui_components_border_draw(x0, y0, x1, y1); + ui_components_progressbar_draw(x0, y0, x1, y1, position); } -void component_loader_draw (float progress) { +void ui_components_loader_draw (float progress) { int x0 = LOADER_X; int y0 = LOADER_Y; int x1 = LOADER_X + LOADER_WIDTH; int y1 = LOADER_Y + LOADER_HEIGHT; - component_border_draw(x0, y0, x1, y1); - component_progressbar_draw(x0, y0, x1, y1, progress); + ui_components_border_draw(x0, y0, x1, y1); + ui_components_progressbar_draw(x0, y0, x1, y1, progress); } -void component_scrollbar_draw (int x, int y, int width, int height, int position, int items, int visible_items) { +void ui_components_scrollbar_draw (int x, int y, int width, int height, int position, int items, int visible_items) { if (items <= 1 || items <= visible_items) { - component_box_draw(x, y, x + width, y + height, SCROLLBAR_INACTIVE_COLOR); + ui_components_box_draw(x, y, x + width, y + height, SCROLLBAR_INACTIVE_COLOR); } else { int scroll_height = (int) ((visible_items / (float) (items)) * height); float scroll_position = ((position / (float) (items - 1)) * (height - scroll_height)); - component_box_draw(x, y, x + width, y + height, SCROLLBAR_BG_COLOR); - component_box_draw(x, y + scroll_position, x + width, y + scroll_position + scroll_height, SCROLLBAR_POSITION_COLOR); + ui_components_box_draw(x, y, x + width, y + height, SCROLLBAR_BG_COLOR); + ui_components_box_draw(x, y + scroll_position, x + width, y + scroll_position + scroll_height, SCROLLBAR_POSITION_COLOR); } } -void component_list_scrollbar_draw (int position, int items, int visible_items) { - component_scrollbar_draw( +void ui_components_list_scrollbar_draw (int position, int items, int visible_items) { + ui_components_scrollbar_draw( LIST_SCROLLBAR_X, LIST_SCROLLBAR_Y, LIST_SCROLLBAR_WIDTH, @@ -92,17 +92,17 @@ void component_list_scrollbar_draw (int position, int items, int visible_items) ); } -void component_dialog_draw (int width, int height) { +void ui_components_dialog_draw (int width, int height) { int x0 = DISPLAY_CENTER_X - (width / 2); int y0 = DISPLAY_CENTER_Y - (height / 2); int x1 = DISPLAY_CENTER_X + (width / 2); int y1 = DISPLAY_CENTER_Y + (height / 2); - component_border_draw(x0, y0, x1, y1); - component_box_draw(x0, y0, x1, y1, DIALOG_BG_COLOR); + ui_components_border_draw(x0, y0, x1, y1); + ui_components_box_draw(x0, y0, x1, y1, DIALOG_BG_COLOR); } -void component_messagebox_draw (char *fmt, ...) { +void ui_components_messagebox_draw (char *fmt, ...) { char buffer[512]; size_t nbytes = sizeof(buffer); @@ -126,7 +126,7 @@ void component_messagebox_draw (char *fmt, ...) { free(formatted); } - component_dialog_draw( + ui_components_dialog_draw( paragraph->bbox.x1 - paragraph->bbox.x0 + MESSAGEBOX_MARGIN, paragraph->bbox.y1 - paragraph->bbox.y0 + MESSAGEBOX_MARGIN ); @@ -136,7 +136,7 @@ void component_messagebox_draw (char *fmt, ...) { rdpq_paragraph_free(paragraph); } -void component_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...) { +void ui_components_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...) { char buffer[1024]; size_t nbytes = sizeof(buffer); @@ -166,7 +166,7 @@ void component_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *f } } -void component_actions_bar_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...) { +void ui_components_actions_bar_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...) { char buffer[256]; size_t nbytes = sizeof(buffer); diff --git a/src/menu/components/constants.h b/src/menu/ui_components/constants.h similarity index 100% rename from src/menu/components/constants.h rename to src/menu/ui_components/constants.h diff --git a/src/menu/components/context_menu.c b/src/menu/ui_components/context_menu.c similarity index 87% rename from src/menu/components/context_menu.c rename to src/menu/ui_components/context_menu.c index abf1947e..b08085fc 100644 --- a/src/menu/components/context_menu.c +++ b/src/menu/ui_components/context_menu.c @@ -1,4 +1,4 @@ -#include "../components.h" +#include "../ui_components.h" #include "../fonts.h" #include "../sound.h" #include "constants.h" @@ -12,7 +12,7 @@ static component_context_menu_t *get_current_submenu (component_context_menu_t * } -void component_context_menu_init (component_context_menu_t *cm) { +void ui_components_context_menu_init (component_context_menu_t *cm) { cm->row_selected = -1; cm->row_count = 0; cm->hide_pending = false; @@ -22,12 +22,12 @@ void component_context_menu_init (component_context_menu_t *cm) { } } -void component_context_menu_show (component_context_menu_t *cm) { +void ui_components_context_menu_show (component_context_menu_t *cm) { cm->row_selected = 0; cm->submenu = NULL; } -bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm) { +bool ui_components_context_menu_process (menu_t *menu, component_context_menu_t *cm) { if (!cm || (cm->row_selected < 0)) { return false; } @@ -46,7 +46,7 @@ bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm) } else if (menu->actions.enter) { if (cm->list[cm->row_selected].submenu) { cm->submenu = cm->list[cm->row_selected].submenu; - component_context_menu_init(cm->submenu); + ui_components_context_menu_init(cm->submenu); cm->submenu->row_selected = 0; cm->submenu->parent = cm; } else if (cm->list[cm->row_selected].action) { @@ -71,7 +71,7 @@ bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm) return true; } -void component_context_menu_draw (component_context_menu_t *cm) { +void ui_components_context_menu_draw (component_context_menu_t *cm) { if (!cm || (cm->row_selected < 0)) { return; } @@ -105,14 +105,14 @@ void component_context_menu_draw (component_context_menu_t *cm) { int width = layout->bbox.x1 - layout->bbox.x0 + MESSAGEBOX_MARGIN; int height = layout->bbox.y1 - layout->bbox.y0 + MESSAGEBOX_MARGIN; - component_dialog_draw(width, height); + ui_components_dialog_draw(width, height); int highlight_x0 = DISPLAY_CENTER_X - (width / 2); int highlight_x1 = DISPLAY_CENTER_X + (width / 2); int highlight_height = (layout->bbox.y1 - layout->bbox.y0) / layout->nlines; int highlight_y = VISIBLE_AREA_Y0 + layout->bbox.y0 + ((cm->row_selected) * highlight_height); - component_box_draw( + ui_components_box_draw( highlight_x0, highlight_y, highlight_x1, diff --git a/src/menu/components/file_list.c b/src/menu/ui_components/file_list.c similarity index 95% rename from src/menu/components/file_list.c rename to src/menu/ui_components/file_list.c index 7a9835ce..af10e3a0 100644 --- a/src/menu/components/file_list.c +++ b/src/menu/ui_components/file_list.c @@ -1,6 +1,6 @@ #include -#include "../components.h" +#include "../ui_components.h" #include "../fonts.h" #include "constants.h" @@ -25,7 +25,7 @@ static int format_file_size (char *buffer, int64_t size) { } -void component_file_list_draw (entry_t *list, int entries, int selected) { +void ui_components_file_list_draw (entry_t *list, int entries, int selected) { int starting_position = 0; if (entries > LIST_ENTRIES && selected >= (LIST_ENTRIES / 2)) { @@ -35,10 +35,10 @@ void component_file_list_draw (entry_t *list, int entries, int selected) { } } - component_list_scrollbar_draw(selected, entries, LIST_ENTRIES); + ui_components_list_scrollbar_draw(selected, entries, LIST_ENTRIES); if (entries == 0) { - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "^%02X** empty directory **", STL_GRAY @@ -117,7 +117,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) { int highlight_height = (layout->bbox.y1 - layout->bbox.y0) / layout->nlines; int highlight_y = VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL + ((selected - starting_position) * highlight_height); - component_box_draw( + ui_components_box_draw( FILE_LIST_HIGHLIGHT_X, highlight_y, FILE_LIST_HIGHLIGHT_X + FILE_LIST_HIGHLIGHT_WIDTH, diff --git a/src/menu/views/browser.c b/src/menu/views/browser.c index 2ff3c867..abe86b59 100644 --- a/src/menu/views/browser.c +++ b/src/menu/views/browser.c @@ -288,11 +288,11 @@ static component_context_menu_t settings_context_menu = { }; static void process (menu_t *menu) { - if (component_context_menu_process(menu, &entry_context_menu)) { + if (ui_components_context_menu_process(menu, &entry_context_menu)) { return; } - if (component_context_menu_process(menu, &settings_context_menu)) { + if (ui_components_context_menu_process(menu, &settings_context_menu)) { return; } @@ -353,10 +353,10 @@ static void process (menu_t *menu) { } sound_play_effect(SFX_EXIT); } else if (menu->actions.options && menu->browser.entry) { - component_context_menu_show(&entry_context_menu); + ui_components_context_menu_show(&entry_context_menu); sound_play_effect(SFX_SETTING); } else if (menu->actions.settings) { - component_context_menu_show(&settings_context_menu); + ui_components_context_menu_show(&settings_context_menu); sound_play_effect(SFX_SETTING); } } @@ -365,11 +365,11 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_file_list_draw(menu->browser.list, menu->browser.entries, menu->browser.selected); + ui_components_file_list_draw(menu->browser.list, menu->browser.entries, menu->browser.selected); const char *action = NULL; @@ -385,7 +385,7 @@ static void draw (menu_t *menu, surface_t *d) { } } - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "%s\n" "^%02XB: Back^00", @@ -393,7 +393,7 @@ static void draw (menu_t *menu, surface_t *d) { path_is_root(menu->browser.directory) ? STL_GRAY : STL_DEFAULT ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_RIGHT, VALIGN_TOP, "Start: Settings\n" "^%02XR: Options^00", @@ -401,7 +401,7 @@ static void draw (menu_t *menu, surface_t *d) { ); if (menu->current_time >= 0) { - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_CENTER, VALIGN_TOP, "\n" "%s", @@ -409,9 +409,9 @@ static void draw (menu_t *menu, surface_t *d) { ); } - component_context_menu_draw(&entry_context_menu); + ui_components_context_menu_draw(&entry_context_menu); - component_context_menu_draw(&settings_context_menu); + ui_components_context_menu_draw(&settings_context_menu); rdpq_detach_show(); } @@ -419,8 +419,8 @@ static void draw (menu_t *menu, surface_t *d) { void view_browser_init (menu_t *menu) { if (!menu->browser.valid) { - component_context_menu_init(&entry_context_menu); - component_context_menu_init(&settings_context_menu); + ui_components_context_menu_init(&entry_context_menu); + ui_components_context_menu_init(&settings_context_menu); if (load_directory(menu)) { path_free(menu->browser.directory); menu->browser.directory = path_init(menu->storage_prefix, ""); diff --git a/src/menu/views/credits.c b/src/menu/views/credits.c index 1889232a..3595b30c 100644 --- a/src/menu/views/credits.c +++ b/src/menu/views/credits.c @@ -20,16 +20,16 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "MENU INFORMATION" ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -54,7 +54,7 @@ static void draw (menu_t *menu, surface_t *d) { BUILD_TIMESTAMP ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "B: Exit" diff --git a/src/menu/views/error.c b/src/menu/views/error.c index 7cb4f7d2..b163f885 100644 --- a/src/menu/views/error.c +++ b/src/menu/views/error.c @@ -12,12 +12,12 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); if (menu->error_message) { - component_messagebox_draw(menu->error_message); + ui_components_messagebox_draw(menu->error_message); } else { - component_messagebox_draw("Unspecified error"); + ui_components_messagebox_draw("Unspecified error"); } rdpq_detach_show(); diff --git a/src/menu/views/fault.c b/src/menu/views/fault.c index 6ec767a4..ee2f8c5e 100644 --- a/src/menu/views/fault.c +++ b/src/menu/views/fault.c @@ -13,7 +13,7 @@ static void draw (menu_t *menu, surface_t *d) { "SummerCart64: 2.17.0+" ); - component_messagebox_draw( + ui_components_messagebox_draw( "UNRECOVERABLE ERROR\n" "\n" "%s\n" diff --git a/src/menu/views/file_info.c b/src/menu/views/file_info.c index 9d45574b..be204e5f 100644 --- a/src/menu/views/file_info.c +++ b/src/menu/views/file_info.c @@ -58,11 +58,11 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "ENTRY INFORMATION\n" "\n" @@ -70,7 +70,7 @@ static void draw (menu_t *menu, surface_t *d) { menu->browser.entry->name ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -87,7 +87,7 @@ static void draw (menu_t *menu, surface_t *d) { ctime(&st.st_mtime) ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "B: Exit" diff --git a/src/menu/views/flashcart_info.c b/src/menu/views/flashcart_info.c index 635ef2ca..abf99991 100644 --- a/src/menu/views/flashcart_info.c +++ b/src/menu/views/flashcart_info.c @@ -36,18 +36,18 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "FLASHCART INFORMATION" "\n" "\n" ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -78,7 +78,7 @@ static void draw (menu_t *menu, surface_t *d) { //format_diagnostic_data(flashcart_has_feature(FLASHCART_FEATURE_DIAGNOSTIC_DATA)) ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "B: Back" diff --git a/src/menu/views/image_viewer.c b/src/menu/views/image_viewer.c index d58d3743..64af16f6 100644 --- a/src/menu/views/image_viewer.c +++ b/src/menu/views/image_viewer.c @@ -58,9 +58,9 @@ static void draw (menu_t *menu, surface_t *d) { if (!image) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_loader_draw(png_decoder_get_progress()); + ui_components_loader_draw(png_decoder_get_progress()); } else { rdpq_attach_clear(d, NULL); @@ -73,13 +73,13 @@ static void draw (menu_t *menu, surface_t *d) { rdpq_mode_pop(); if (show_message) { - component_messagebox_draw( + ui_components_messagebox_draw( "Set \"%s\" as background image?\n\n" "A: Yes, B: Back", menu->browser.entry->name ); } else if (image_set_as_background) { - component_messagebox_draw("Preparing background…"); + ui_components_messagebox_draw("Preparing background…"); } } @@ -93,7 +93,7 @@ static void deinit (menu_t *menu) { if (image) { if (image_set_as_background) { - component_background_replace_image(image); + ui_components_background_replace_image(image); } else { surface_free(image); free(image); diff --git a/src/menu/views/load_disk.c b/src/menu/views/load_disk.c index 9ba914d9..c1e24a79 100644 --- a/src/menu/views/load_disk.c +++ b/src/menu/views/load_disk.c @@ -45,14 +45,14 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); if (menu->boot_pending.disk_file) { - component_loader_draw(0.0f); + ui_components_loader_draw(0.0f); } else { - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "64DD disk information\n" "\n" @@ -60,7 +60,7 @@ static void draw (menu_t *menu, surface_t *d) { menu->browser.entry->name ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -80,21 +80,21 @@ static void draw (menu_t *menu, surface_t *d) { menu->load.rom_path ? path_last_get(menu->load.rom_path) : "" ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "A: Load and run 64DD disk\n" "B: Exit" ); if (menu->load.rom_path) { - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_RIGHT, VALIGN_TOP, "R: Load with ROM" ); } if (boxart != NULL) { - component_boxart_draw(boxart); + ui_components_boxart_draw(boxart); } } @@ -107,9 +107,9 @@ static void draw_progress (float progress) { if (d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_loader_draw(progress); + ui_components_loader_draw(progress); rdpq_detach_show(); } @@ -153,7 +153,7 @@ static void load (menu_t *menu) { } static void deinit (void) { - component_boxart_free(boxart); + ui_components_boxart_free(boxart); } void view_load_disk_init (menu_t *menu) { @@ -172,7 +172,7 @@ void view_load_disk_init (menu_t *menu) { return; } - boxart = component_boxart_init(menu->storage_prefix, menu->load.disk_info.id, IMAGE_BOXART_FRONT); + boxart = ui_components_boxart_init(menu->storage_prefix, menu->load.disk_info.id, IMAGE_BOXART_FRONT); } void view_load_disk_display (menu_t *menu, surface_t *display) { diff --git a/src/menu/views/load_emulator.c b/src/menu/views/load_emulator.c index 3a131722..ad923145 100644 --- a/src/menu/views/load_emulator.c +++ b/src/menu/views/load_emulator.c @@ -43,19 +43,19 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); if (menu->boot_pending.emulator_file) { - component_loader_draw(0.0f); + ui_components_loader_draw(0.0f); } else { - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "Load Emulated ROM\n" ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -65,7 +65,7 @@ static void draw (menu_t *menu, surface_t *d) { menu->browser.entry->name ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "A: Load and run Emulated ROM\n" "B: Exit" @@ -81,9 +81,9 @@ static void draw_progress (float progress) { if (d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_loader_draw(progress); + ui_components_loader_draw(progress); rdpq_detach_show(); } diff --git a/src/menu/views/load_rom.c b/src/menu/views/load_rom.c index 2a4ce34d..fb95003f 100644 --- a/src/menu/views/load_rom.c +++ b/src/menu/views/load_rom.c @@ -203,7 +203,7 @@ static component_context_menu_t options_context_menu = { .list = { }}; static void process (menu_t *menu) { - if (component_context_menu_process(menu, &options_context_menu)) { + if (ui_components_context_menu_process(menu, &options_context_menu)) { return; } @@ -213,7 +213,7 @@ static void process (menu_t *menu) { sound_play_effect(SFX_EXIT); menu->next_mode = MENU_MODE_BROWSER; } else if (menu->actions.options) { - component_context_menu_show(&options_context_menu); + ui_components_context_menu_show(&options_context_menu); sound_play_effect(SFX_SETTING); } else if (menu->actions.lz_context) { if (show_extra_info_message) { @@ -228,14 +228,14 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); if (menu->boot_pending.rom_file) { - component_loader_draw(0.0f); + ui_components_loader_draw(0.0f); } else { - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "N64 ROM information\n" "\n" @@ -243,7 +243,7 @@ static void draw (menu_t *menu, surface_t *d) { menu->browser.entry->name ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -262,24 +262,24 @@ static void draw (menu_t *menu, surface_t *d) { format_rom_save_type(rom_info_get_save_type(&menu->load.rom_info), menu->load.rom_info.features.controller_pak) ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "A: Load and run ROM\n" "B: Back" ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_RIGHT, VALIGN_TOP, "L|Z: Extra Info\n" "R: Options" ); if (boxart != NULL) { - component_boxart_draw(boxart); + ui_components_boxart_draw(boxart); } if (show_extra_info_message) { - component_messagebox_draw( + ui_components_messagebox_draw( "EXTRA ROM INFO\n" "\n" "Endianness: %s\n" @@ -306,7 +306,7 @@ static void draw (menu_t *menu, surface_t *d) { ); } - component_context_menu_draw(&options_context_menu); + ui_components_context_menu_draw(&options_context_menu); } rdpq_detach_show(); @@ -318,9 +318,9 @@ static void draw_progress (float progress) { if (d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_loader_draw(progress); + ui_components_loader_draw(progress); rdpq_detach_show(); } @@ -348,7 +348,7 @@ static void load (menu_t *menu) { } static void deinit (void) { - component_boxart_free(boxart); + ui_components_boxart_free(boxart); boxart = NULL; } @@ -371,8 +371,8 @@ void view_load_rom_init (menu_t *menu) { } if (!menu->settings.rom_autoload_enabled) { - boxart = component_boxart_init(menu->storage_prefix, menu->load.rom_info.game_code, IMAGE_BOXART_FRONT); - component_context_menu_init(&options_context_menu); + boxart = ui_components_boxart_init(menu->storage_prefix, menu->load.rom_info.game_code, IMAGE_BOXART_FRONT); + ui_components_context_menu_init(&options_context_menu); } } diff --git a/src/menu/views/music_player.c b/src/menu/views/music_player.c index c540bfab..b2dde597 100644 --- a/src/menu/views/music_player.c +++ b/src/menu/views/music_player.c @@ -61,13 +61,13 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_seekbar_draw(mp3player_get_progress()); + ui_components_seekbar_draw(mp3player_get_progress()); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "MUSIC PLAYER\n" "\n" @@ -83,7 +83,7 @@ static void draw (menu_t *menu, surface_t *d) { mp3player_get_duration() ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -102,7 +102,7 @@ static void draw (menu_t *menu, surface_t *d) { mp3player_get_samplerate() ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "A: %s\n" "B: Exit | Left / Right: Rewind / Fast forward", diff --git a/src/menu/views/rtc.c b/src/menu/views/rtc.c index 88196d00..f7e93dad 100644 --- a/src/menu/views/rtc.c +++ b/src/menu/views/rtc.c @@ -110,7 +110,7 @@ void component_editdatetime_draw ( struct tm t, rtc_field_t selected_field ) { snprintf( current_selection_chars, sizeof(current_selection_chars), "******************^^^^*****"); break; } - component_messagebox_draw( + ui_components_messagebox_draw( "|YYYY|MM|DD|HH|MM|SS| DOW\n%s\n%s\n", full_dt, current_selection_chars); } @@ -165,14 +165,14 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); if (!is_editing_mode) { if( menu->current_time >= 0 ) { - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "ADJUST REAL TIME CLOCK\n" "\n" @@ -186,7 +186,7 @@ static void draw (menu_t *menu, surface_t *d) { menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown" ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "A: Change\n" "B: Back" @@ -194,7 +194,7 @@ static void draw (menu_t *menu, surface_t *d) { } else { - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "ADJUST REAL TIME CLOCK\n" "\n" @@ -206,7 +206,7 @@ static void draw (menu_t *menu, surface_t *d) { menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown" ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "B: Back" @@ -214,12 +214,12 @@ static void draw (menu_t *menu, surface_t *d) { } } else { - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_RIGHT, VALIGN_TOP, "Up/Down: Adjust Field\n" "Left/Right: Switch Field" ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "R: Save\n" "B: Back" diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 068b4675..4b2467d1 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -106,12 +106,12 @@ static component_context_menu_t options_context_menu = { .list = { static void process (menu_t *menu) { - if (component_context_menu_process(menu, &options_context_menu)) { + if (ui_components_context_menu_process(menu, &options_context_menu)) { return; } if (menu->actions.enter) { - component_context_menu_show(&options_context_menu); + ui_components_context_menu_show(&options_context_menu); sound_play_effect(SFX_SETTING); } else if (menu->actions.back) { sound_play_effect(SFX_EXIT); @@ -122,17 +122,17 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "MENU SETTINGS EDITOR\n" "\n" ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n\n" " Default Directory : %s\n\n" @@ -163,13 +163,13 @@ static void draw (menu_t *menu, surface_t *d) { ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "A: Change\n" "B: Back" ); - component_context_menu_draw(&options_context_menu); + ui_components_context_menu_draw(&options_context_menu); rdpq_detach_show(); } @@ -177,7 +177,7 @@ static void draw (menu_t *menu, surface_t *d) { void view_settings_init (menu_t *menu) { - component_context_menu_init(&options_context_menu); + ui_components_context_menu_init(&options_context_menu); } diff --git a/src/menu/views/system_info.c b/src/menu/views/system_info.c index 18cffb0d..653ee0b0 100644 --- a/src/menu/views/system_info.c +++ b/src/menu/views/system_info.c @@ -36,16 +36,16 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_CENTER, VALIGN_TOP, "N64 SYSTEM INFORMATION" ); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "\n" @@ -65,7 +65,7 @@ static void draw (menu_t *menu, surface_t *d) { (joypad[3]) ? "" : "not ", format_accessory(3) ); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n" "B: Exit" diff --git a/src/menu/views/text_viewer.c b/src/menu/views/text_viewer.c index 0339ba37..b3cdb559 100644 --- a/src/menu/views/text_viewer.c +++ b/src/menu/views/text_viewer.c @@ -1,7 +1,7 @@ #include #include -#include "../components/constants.h" +#include "../ui_components/constants.h" #include "../fonts.h" #include "../sound.h" #include "utils/utils.h" @@ -69,19 +69,19 @@ static void process (menu_t *menu) { static void draw (menu_t *menu, surface_t *d) { rdpq_attach(d, NULL); - component_background_draw(); + ui_components_background_draw(); - component_layout_draw(); + ui_components_layout_draw(); - component_main_text_draw( + ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "%s\n", text->contents + text->offset ); - component_list_scrollbar_draw(text->current_line, text->lines, LIST_ENTRIES); + ui_components_list_scrollbar_draw(text->current_line, text->lines, LIST_ENTRIES); - component_actions_bar_text_draw( + ui_components_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "^%02XUp / Down: Scroll^00\n" "B: Back", diff --git a/src/menu/views/views.h b/src/menu/views/views.h index 8da900dc..8c475280 100644 --- a/src/menu/views/views.h +++ b/src/menu/views/views.h @@ -8,7 +8,7 @@ #define VIEWS_H__ -#include "../components.h" +#include "../ui_components.h" #include "../menu_state.h"