From 5cb1b2935f937317df57b668c9a8880e1f273378 Mon Sep 17 00:00:00 2001 From: Moksh Date: Fri, 15 Sep 2023 16:09:06 +1000 Subject: [PATCH 01/18] Added code for custom cursor --- source/core/assets/images/ui/mouse_effect.png | Bin 0 -> 1540 bytes .../components/mainmenu/MainMenuDisplay.java | 39 ++++++++++-------- 2 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 source/core/assets/images/ui/mouse_effect.png diff --git a/source/core/assets/images/ui/mouse_effect.png b/source/core/assets/images/ui/mouse_effect.png new file mode 100644 index 0000000000000000000000000000000000000000..7653c4a2e0ea77c39b96cedb48366e026518aa16 GIT binary patch literal 1540 zcmcIiX;4#F6uwD#TSCY}wFvD@M-7PJ7$D+E+YvCSP!?IDpmm8XGFnrugd*BvM*D+J zD?ut2;u1?ON=GqsVz(m$|^_}4Cu5??;~wzI@A8_oBQr^&iT&yzH@JB zO7eOp-JcEsV8+J@)8HBn|F>`&oU7NJ(36MkxU?hy4g~@r{~Ul<&?FxNpnwm+gam-7 z8USA3UuRBz2LS5!lti%z2H@HWyk(rYI*RKiF@ufJj1ev4xPA&VJH4*I1a3Fd_7XEY z2>lcthUuqqqXTrgaf1Vgdy^fxK8M_x!;LoFXlH0gXy3UR&BKJzhFV;>b`sZ2V1{Yb z{DROur|TwIs$TYm9^7D~YsTrCG2AfCRd%o&9{4J|y>9-_`uZXFLO1ocJD^0vR`oK~ zLqP>K?D`)$=ejv(?=l;${uKsh!+>|gAfXu#DAOW0eq~+kquq4-p6&6u)W7iT9n4@S zTAr~~57-yG=+{OFgAFrI6WU2evlVHZqup{dw4>mz8{BhaCOe^DyAb&+zkQ!oH(BrTQ~n9%`Q!Oi^91zSOe zwa#MZ8P>Oh?D_`~;=$r%PO=JSa*~BCF3bo?+A)&@X`O>%u&bok>?DWD=^+4nNVLFC z+Mo;9KZiU?AoQAM2<7`Cub{U;y{gL zMfeg(wkD@{!!I6^^YgsSE05=8y8dhk?9V(IGKmS&Bc(wgd_QitTPg1gg)gjAmX@3j z*Z<)|2%kvFXQcukBKDMQ(|d}N7{XV2TI@$luincpIKGTR2`tUWwkQ@?Zbqp=%2?VN z9u?VkoJ--9GmmAVDCM=2iC*t7p!j}q43RLmu&IHyG+ImzR=I??87&W{R>*2H{Jl1n zW+WtKesapEyjb9~wlkOql~A%0)(boLwB>Du2TT^9B*I1s7D_|KyrP%TeK}qjBaZ9H zmiQq8q$05^w6QU?Ywu*v?!3{*PltRMEY_0|>+qAHZ8zlSQ-nEUSz@A0ytnS;RlMPq z==P9r7Pm@~o~Ecu>%AXwix=0sGPwFowX&)gZfI6r z?*2f(yffrr$nv>m(m{>%aHV-AfyyI#Pbe+&GoAO2%r?FIwkDhw*L8wBv`BrJp>R#D z-EaHe+NNHbmxrPpYx|OR>hPF8JGEnjSLOEee7?D1gP+W|DJ>|U8&Im z0Ibgsy^*O??t>S}lZi5AIXh*!QP~G_;R3?>;SnqNYgUA<67wUY_z_Wjeh8lr=WS(6 zpZ)_N-Iud_SJ8h1Li_77Az<0x6=b`mx%sl4(*6H}iS!il Date: Sat, 16 Sep 2023 17:26:01 +1000 Subject: [PATCH 02/18] Cursor added --- source/core/assets/images/ui/mouse_effect.png | Bin 1540 -> 881 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/source/core/assets/images/ui/mouse_effect.png b/source/core/assets/images/ui/mouse_effect.png index 7653c4a2e0ea77c39b96cedb48366e026518aa16..b9d818a24c908b274ed1284dd623d005dfb8e282 100644 GIT binary patch literal 881 zcmV-%1CIQOP)+;#^@`k(ArOe-~(BiJr;?Csm&*bj;{Qb@2 z?XA(`lET>L^7fs|-KNgqu+-zg-08K}<;mgf(B$sC+2_sU?ZDjW#NO)9#k?EL=j{QhRJ&G7vG^8Nm6t;_2B{ffWV-ShZ-!PuqO=6}4^=lT4X z&*I_r`em!iY_-vOyVSem?!)Hrj>_JBx6yI1&3CiTc)r$TuFT{2`>)*UtlH_<@%Mwo z+R5qiiO1c~sn2(~($DSmVX4Szvd?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Oh?D_`~;=$r%PO=JSa*~BCF3bo?+A)&@X`O>%u&bok>?DWD=^+4nNVLFC z+Mo;9KZiU?AoQAM2<7`Cub{U;y{gL zMfeg(wkD@{!!I6^^YgsSE05=8y8dhk?9V(IGKmS&Bc(wgd_QitTPg1gg)gjAmX@3j z*Z<)|2%kvFXQcukBKDMQ(|d}N7{XV2TI@$luincpIKGTR2`tUWwkQ@?Zbqp=%2?VN z9u?VkoJ--9GmmAVDCM=2iC*t7p!j}q43RLmu&IHyG+ImzR=I??87&W{R>*2H{Jl1n zW+WtKesapEyjb9~wlkOql~A%0)(boLwB>Du2TT^9B*I1s7D_|KyrP%TeK}qjBaZ9H zmiQq8q$05^w6QU?Ywu*v?!3{*PltRMEY_0|>+qAHZ8zlSQ-nEUSz@A0ytnS;RlMPq z==P9r7Pm@~o~Ecu>%AXwix=0sGPwFowX&)gZfI6r z?*2f(yffrr$nv>m(m{>%aHV-AfyyI#Pbe+&GoAO2%r?FIwkDhw*L8wBv`BrJp>R#D z-EaHe+NNHbmxrPpYx|OR>hPF8JGEnjSLOEee7?D1gP+W|DJ>|U8&Im z0Ibgsy^*O??t>S}lZi5AIXh*!QP~G_;R3?>;SnqNYgUA<67wUY_z_Wjeh8lr=WS(6 zpZ)_N-Iud_SJ8h1Li_77Az<0x6=b`mx%sl4(*6H}iS!il Date: Sun, 17 Sep 2023 20:44:31 +1000 Subject: [PATCH 03/18] Created a method to implement different types of button universally --- source/core/assets/configs/text.json | 7 ++ source/core/assets/images/ui/Button_Bg.png | Bin 0 -> 27269 bytes source/core/assets/images/ui/font.fnt | 99 ++++++++++++++++ source/core/assets/images/ui/font.png | Bin 0 -> 19656 bytes .../components/mainmenu/MainMenuDisplay.java | 20 +++- .../com/csse3200/game/ui/ButtonFactory.java | 108 ++++++++++++++++++ 6 files changed, 230 insertions(+), 4 deletions(-) create mode 100644 source/core/assets/configs/text.json create mode 100644 source/core/assets/images/ui/Button_Bg.png create mode 100644 source/core/assets/images/ui/font.fnt create mode 100644 source/core/assets/images/ui/font.png create mode 100644 source/core/src/main/com/csse3200/game/ui/ButtonFactory.java diff --git a/source/core/assets/configs/text.json b/source/core/assets/configs/text.json new file mode 100644 index 000000000..721a313dc --- /dev/null +++ b/source/core/assets/configs/text.json @@ -0,0 +1,7 @@ +{ + "com.badlogic.gdx.graphics.g2d.BitmapFont": { + "default": { + "file": "images/ui/font.fnt" + } + } +} diff --git a/source/core/assets/images/ui/Button_Bg.png b/source/core/assets/images/ui/Button_Bg.png new file mode 100644 index 0000000000000000000000000000000000000000..71e133831a3d8e06f88101ec7e82f6aebea82232 GIT binary patch literal 27269 zcmeI5dsGuw9>-CZvNjcVwQbsh(3R6eT?_cwQ$P_aK3lt@c8{)Lc=#xb3RozE1V{`m zo5lK~KF}3mIo73J6#`l)jxqEgf`Y)-3d3W7m1oV6@Gt}jN%l7(JZvUd_H;eR^#0+w zL+0it&fNRE-`{uc{Um9_`ZY73f9-iQGqaiRu3fpw%*=c({PX+uba+Ks@@9dV+3xq> zUAg>E`~9i9jk{axW?5{kFNChRRC()U^66o>6RNJ3geXqR z2O8eKiuZ^_UWoF1N*+u7ootOuD0}Dvsomogs4E><*VXC*ZN-pk&?|FT-JE(-#EQbx zUJhpWUfqOc?5Htsp}c+UPFv##IDe6IeN#E5_ui{bJi@U)bcMAnCeV|bj%A3YAs=DC z^O?Vky#!mfpu+i4t6)&XA`<(vGK*^yJuaW%bP|d}H@xb&WqXlxAiEBI09>LdJ4|}* zhJUuZ)fJ{o{^yRM{NV$ReKV$XeKAdtk}Ix`;;bK3eG4s@(KmBvO5fGFSOMJ3PpAkV zJHlo#gYTQI&Zu*K6pI%>N-ZT0zo;+2#}yWvFb9Qrx&7;RQW0cUrbTU=$K}6qWY8&I#~Y4YR>u%(rFmNUJUn^VV&S5idy#W@xNf3e z9x3J3?6tLrzsI9pnv0I)+H8G0^3BL)%N!SB4#i;$b)_OKUT}h3D~?r8_oUuLjnLQT z>0gt5?LkV7Mq_E|xkI^5BKCW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Zn0D04dPhvTI68N^FI-Ot;`tpQs+jexC)F zaekZ}6Fm{_d}JJjI(lC)b&#^Br)RW}2y5Hm?y_>rVtjv#H^ALpjupV&Jv@9~!X;HJ zzMcf?dY^SY6xhR(I*mZS*hR!5X(kU768Pc>dw9|T`wl=ibF>ERVffbL>|tw(-sM`33c@d!6};ZA0ar=2Reci6j}asNHjBtxMUO{M#rxj>DQdz z4))~eVd$mtJYGe5(8UzhLC%*jhyFN%ge{};ih)#DJdtBpF^W$20uY@BNOfyGx8h9? zF@wM)vfoc|x*gIf3(UcFoX9yEMRiE_&dxD{-B`Oig54Cxtqx(lPtM5x2CuMR%cMLTTkgD(Z zTLY6*!0F@}p(p+%*#U~}s9Js#0%eL6dQ+)$N60EF0;aj=YTMF0M1WwI@O4a1q{RSA zuctacTk`aqUQsNcueG;|E0*Q+VxhN0N_Hp{XoRco0Eqi$!O8?W0f3Nb`O3h-$!A$0 zE_QwHC2x}QjzGKl62y25K=9?k*pGt{ zGldC*!zbe7;;!ra2sB*)cQ=8GNZWkVIU3~lF^=rEd8~uBGuvOO*#N&QVhoB1-7(w- zn4H=0B~;}s%3EpdS0{do?5K(%;weKWC-f#A3|Y73-`uAi5XLB@9QzrFXDi7rJgGyh zYxhA$Dp8D}hv(qz5%e$|jG%|1xX6Z(xU{ek;*wGFH66bc+|ZQa!D9ExkeqZcO;1nn z3nm`6-Pq1%Qe=MCcxX>el99C5+JibmBi56Bs%7~`GFvvJwXp)S^sZt4WV$-+XOpV^ zZ}aCZ6u!}Z>1OK5(^qCiZr)z;UisD}_xTHh;l(Q36vG#FHN7LZJyvu4?bmi%{c*g7 z@zH}AYSeApAy=(7 qlPJrxnfNgi-u!>~Z}stKyttL9pY@w>;OC{x-d(kRWtMkf!hZpA29${a literal 0 HcmV?d00001 diff --git a/source/core/assets/images/ui/font.fnt b/source/core/assets/images/ui/font.fnt new file mode 100644 index 000000000..1c8e0fa9d --- /dev/null +++ b/source/core/assets/images/ui/font.fnt @@ -0,0 +1,99 @@ +info face="Times New Roman" size=-32 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=0 aa=1 padding=0,0,0,0 spacing=0,0 outline=0 +common lineHeight=37 base=29 scaleW=256 scaleH=128 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4 +page id=0 file="font.png" +chars count=95 +char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=0 xadvance=8 page=0 chnl=15 +char id=33 x=251 y=20 width=4 height=23 xoffset=4 yoffset=6 xadvance=12 page=0 chnl=15 +char id=34 x=47 y=96 width=9 height=10 xoffset=2 yoffset=6 xadvance=13 page=0 chnl=15 +char id=35 x=151 y=15 width=15 height=23 xoffset=1 yoffset=6 xadvance=17 page=0 chnl=15 +char id=36 x=169 y=77 width=13 height=26 xoffset=2 yoffset=5 xadvance=17 page=0 chnl=15 +char id=37 x=0 y=82 width=25 height=24 xoffset=1 yoffset=6 xadvance=27 page=0 chnl=15 +char id=38 x=21 y=53 width=23 height=24 xoffset=1 yoffset=6 xadvance=25 page=0 chnl=15 +char id=39 x=61 y=96 width=3 height=10 xoffset=1 yoffset=6 xadvance=5 page=0 chnl=15 +char id=40 x=218 y=37 width=9 height=30 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 +char id=41 x=225 y=67 width=9 height=30 xoffset=0 yoffset=6 xadvance=10 page=0 chnl=15 +char id=42 x=232 y=0 width=11 height=13 xoffset=2 yoffset=6 xadvance=15 page=0 chnl=15 +char id=43 x=155 y=105 width=17 height=18 xoffset=1 yoffset=10 xadvance=19 page=0 chnl=15 +char id=44 x=56 y=96 width=5 height=9 xoffset=1 yoffset=25 xadvance=8 page=0 chnl=15 +char id=45 x=52 y=24 width=8 height=3 xoffset=1 yoffset=20 xadvance=10 page=0 chnl=15 +char id=46 x=38 y=77 width=3 height=4 xoffset=2 yoffset=25 xadvance=7 page=0 chnl=15 +char id=47 x=198 y=100 width=9 height=23 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=15 +char id=48 x=166 y=15 width=14 height=23 xoffset=1 yoffset=6 xadvance=16 page=0 chnl=15 +char id=49 x=206 y=15 width=10 height=22 xoffset=3 yoffset=7 xadvance=16 page=0 chnl=15 +char id=50 x=141 y=82 width=15 height=23 xoffset=1 yoffset=6 xadvance=16 page=0 chnl=15 +char id=51 x=156 y=82 width=13 height=23 xoffset=1 yoffset=6 xadvance=16 page=0 chnl=15 +char id=52 x=160 y=38 width=14 height=22 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=15 +char id=53 x=184 y=55 width=13 height=22 xoffset=2 yoffset=7 xadvance=16 page=0 chnl=15 +char id=54 x=180 y=15 width=13 height=23 xoffset=1 yoffset=6 xadvance=16 page=0 chnl=15 +char id=55 x=141 y=105 width=14 height=22 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=15 +char id=56 x=186 y=100 width=12 height=23 xoffset=2 yoffset=6 xadvance=16 page=0 chnl=15 +char id=57 x=182 y=77 width=13 height=23 xoffset=1 yoffset=6 xadvance=16 page=0 chnl=15 +char id=58 x=236 y=13 width=3 height=15 xoffset=3 yoffset=14 xadvance=9 page=0 chnl=15 +char id=59 x=251 y=0 width=5 height=20 xoffset=2 yoffset=14 xadvance=9 page=0 chnl=15 +char id=60 x=167 y=60 width=17 height=17 xoffset=1 yoffset=10 xadvance=19 page=0 chnl=15 +char id=61 x=29 y=22 width=17 height=7 xoffset=1 yoffset=15 xadvance=19 page=0 chnl=15 +char id=62 x=174 y=38 width=17 height=17 xoffset=1 yoffset=10 xadvance=19 page=0 chnl=15 +char id=63 x=195 y=77 width=12 height=23 xoffset=1 yoffset=6 xadvance=14 page=0 chnl=15 +char id=64 x=0 y=0 width=29 height=30 xoffset=1 yoffset=6 xadvance=30 page=0 chnl=15 +char id=65 x=0 y=106 width=24 height=22 xoffset=-1 yoffset=7 xadvance=23 page=0 chnl=15 +char id=66 x=71 y=95 width=20 height=22 xoffset=0 yoffset=7 xadvance=22 page=0 chnl=15 +char id=67 x=70 y=71 width=20 height=24 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=15 +char id=68 x=47 y=74 width=23 height=22 xoffset=0 yoffset=7 xadvance=24 page=0 chnl=15 +char id=69 x=90 y=71 width=20 height=22 xoffset=0 yoffset=7 xadvance=20 page=0 chnl=15 +char id=70 x=111 y=44 width=17 height=22 xoffset=0 yoffset=7 xadvance=18 page=0 chnl=15 +char id=71 x=25 y=82 width=22 height=24 xoffset=1 yoffset=6 xadvance=23 page=0 chnl=15 +char id=72 x=48 y=106 width=23 height=22 xoffset=0 yoffset=7 xadvance=24 page=0 chnl=15 +char id=73 x=216 y=15 width=10 height=22 xoffset=0 yoffset=7 xadvance=11 page=0 chnl=15 +char id=74 x=197 y=53 width=12 height=23 xoffset=0 yoffset=7 xadvance=12 page=0 chnl=15 +char id=75 x=24 y=106 width=24 height=22 xoffset=0 yoffset=7 xadvance=24 page=0 chnl=15 +char id=76 x=91 y=46 width=20 height=22 xoffset=0 yoffset=7 xadvance=20 page=0 chnl=15 +char id=77 x=29 y=0 width=28 height=22 xoffset=0 yoffset=7 xadvance=29 page=0 chnl=15 +char id=78 x=57 y=0 width=24 height=22 xoffset=-1 yoffset=7 xadvance=23 page=0 chnl=15 +char id=79 x=78 y=22 width=21 height=24 xoffset=1 yoffset=6 xadvance=23 page=0 chnl=15 +char id=80 x=118 y=22 width=17 height=22 xoffset=0 yoffset=7 xadvance=18 page=0 chnl=15 +char id=81 x=0 y=53 width=21 height=29 xoffset=1 yoffset=6 xadvance=23 page=0 chnl=15 +char id=82 x=81 y=0 width=22 height=22 xoffset=0 yoffset=7 xadvance=21 page=0 chnl=15 +char id=83 x=172 y=103 width=14 height=24 xoffset=2 yoffset=6 xadvance=18 page=0 chnl=15 +char id=84 x=103 y=0 width=18 height=22 xoffset=1 yoffset=7 xadvance=19 page=0 chnl=15 +char id=85 x=30 y=29 width=24 height=23 xoffset=-1 yoffset=7 xadvance=22 page=0 chnl=15 +char id=86 x=44 y=52 width=24 height=22 xoffset=0 yoffset=7 xadvance=24 page=0 chnl=15 +char id=87 x=0 y=30 width=30 height=23 xoffset=0 yoffset=7 xadvance=30 page=0 chnl=15 +char id=88 x=54 y=27 width=24 height=22 xoffset=0 yoffset=7 xadvance=24 page=0 chnl=15 +char id=89 x=68 y=49 width=23 height=22 xoffset=0 yoffset=7 xadvance=23 page=0 chnl=15 +char id=90 x=99 y=22 width=19 height=22 xoffset=0 yoffset=7 xadvance=20 page=0 chnl=15 +char id=91 x=227 y=30 width=8 height=29 xoffset=3 yoffset=7 xadvance=12 page=0 chnl=15 +char id=92 x=209 y=53 width=9 height=23 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=15 +char id=93 x=234 y=59 width=8 height=29 xoffset=1 yoffset=7 xadvance=12 page=0 chnl=15 +char id=94 x=91 y=116 width=15 height=12 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15 +char id=95 x=52 y=22 width=17 height=2 xoffset=0 yoffset=35 xadvance=17 page=0 chnl=15 +char id=96 x=46 y=22 width=6 height=6 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 +char id=97 x=195 y=0 width=13 height=15 xoffset=1 yoffset=14 xadvance=15 page=0 chnl=15 +char id=98 x=128 y=44 width=16 height=23 xoffset=-1 yoffset=6 xadvance=16 page=0 chnl=15 +char id=99 x=208 y=0 width=12 height=15 xoffset=1 yoffset=14 xadvance=14 page=0 chnl=15 +char id=100 x=135 y=15 width=16 height=23 xoffset=1 yoffset=6 xadvance=16 page=0 chnl=15 +char id=101 x=220 y=0 width=12 height=15 xoffset=1 yoffset=14 xadvance=14 page=0 chnl=15 +char id=102 x=193 y=15 width=13 height=23 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 +char id=103 x=152 y=60 width=15 height=22 xoffset=1 yoffset=14 xadvance=16 page=0 chnl=15 +char id=104 x=91 y=93 width=17 height=23 xoffset=0 yoffset=6 xadvance=16 page=0 chnl=15 +char id=105 x=243 y=0 width=8 height=23 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=15 +char id=106 x=229 y=97 width=9 height=30 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=15 +char id=107 x=108 y=93 width=17 height=23 xoffset=0 yoffset=6 xadvance=16 page=0 chnl=15 +char id=108 x=235 y=30 width=9 height=23 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=15 +char id=109 x=110 y=68 width=25 height=15 xoffset=0 yoffset=14 xadvance=24 page=0 chnl=15 +char id=110 x=145 y=0 width=17 height=15 xoffset=0 yoffset=14 xadvance=16 page=0 chnl=15 +char id=111 x=191 y=38 width=14 height=15 xoffset=1 yoffset=14 xadvance=16 page=0 chnl=15 +char id=112 x=125 y=83 width=16 height=22 xoffset=-1 yoffset=14 xadvance=16 page=0 chnl=15 +char id=113 x=125 y=105 width=16 height=22 xoffset=1 yoffset=14 xadvance=16 page=0 chnl=15 +char id=114 x=217 y=107 width=12 height=15 xoffset=0 yoffset=14 xadvance=11 page=0 chnl=15 +char id=115 x=226 y=15 width=10 height=15 xoffset=2 yoffset=14 xadvance=13 page=0 chnl=15 +char id=116 x=207 y=107 width=10 height=20 xoffset=0 yoffset=9 xadvance=10 page=0 chnl=15 +char id=117 x=135 y=67 width=17 height=15 xoffset=-1 yoffset=14 xadvance=15 page=0 chnl=15 +char id=118 x=162 y=0 width=17 height=15 xoffset=-1 yoffset=14 xadvance=16 page=0 chnl=15 +char id=119 x=121 y=0 width=24 height=15 xoffset=0 yoffset=14 xadvance=23 page=0 chnl=15 +char id=120 x=179 y=0 width=16 height=15 xoffset=0 yoffset=14 xadvance=16 page=0 chnl=15 +char id=121 x=144 y=38 width=16 height=22 xoffset=0 yoffset=14 xadvance=16 page=0 chnl=15 +char id=122 x=205 y=38 width=13 height=15 xoffset=1 yoffset=14 xadvance=15 page=0 chnl=15 +char id=123 x=207 y=76 width=9 height=31 xoffset=4 yoffset=6 xadvance=15 page=0 chnl=15 +char id=124 x=238 y=88 width=2 height=30 xoffset=2 yoffset=6 xadvance=7 page=0 chnl=15 +char id=125 x=216 y=76 width=9 height=31 xoffset=3 yoffset=6 xadvance=16 page=0 chnl=15 +char id=126 x=21 y=77 width=17 height=5 xoffset=1 yoffset=18 xadvance=18 page=0 chnl=15 diff --git a/source/core/assets/images/ui/font.png b/source/core/assets/images/ui/font.png new file mode 100644 index 0000000000000000000000000000000000000000..628b02462f984ed86a7a6e15f94b1089b0c68837 GIT binary patch literal 19656 zcmV(pK=8kbP)x&dm}9QB_TGN)^Nh!~)?9OrIp=ua_xoN)EaFb3 zy>YWQ-t@)_Z*1|#VQ=jB#wKrk=8ea^QP<&IjlEHz89#a>8cB@mdE=Pjyqyi7zvFoB z8x6mYkE7lw>5Y-z_|!0md~Y1`#x`%P^Ts4^baJ@Yf)tFWxt{L3>$%R?mV1*lRC7$a z_&&oMUA^&zH~tWx-|CH3-Z>Pwd4VWXokSBQKGTud8IE?qkd)_z`C32QG zW_qKka_;?{?^EUTuH3)6erh2Y;tYH*0$?&s^^J1;<;>TA7PFLhxPt$eMR<+#Mw&OS zW=;0tJ@?`LovnFKw=%Eh-na{e)El0N-_x_=*eE8l;Nmm<|ZZbTmsd7(k_CER3}V zbYQzi8uz&X6cAw{wiAMVtMZ$7cpq^(2~DBXa=#$>e-g*WpW_wYm@4L#jZhfojU(O| zgV2xDL|+Rjln#?M;{Wl*y4&zBCUD-{mCxf0@~t--^8YqG3t#Dd!}D$jGV>|Ukbmdz zxUkI=-*xlGyZk*%2*QXE=((U1Ip2SIqdR}ML@*BoeZ_^l_(m6E_@}h;Mu2rhwyrP!@D^Bw`rq z&72FwXE}yr;}4*h0{JEgf#7m~5d}#|+UanPxaNJ8zs~@@=xC0C`CTY3Jf2fN8zTPJ zA+0x+MXjUG2$G+~XFI&H%Nz5>XIaeuX};g9EX0cq=Rbm_JS*36yX@isDZp zIDOPMUm&DBA$Wc24+7|~eEuBo>Lrs2P?{Il07y1B!38*jhx}H6Ik2C_D($?-LR=>U z2)InqXh$u-IjFHev(bt{bcp%p8@|tXoc9~z@0$(B%uevx`}8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L+-uCEn;e>sQf0NQ!y#BBb@h4x=M z5W_BjZkhDB94S?f1s$geOART;+SHW{uz%I004meU(3J-qU}=V%UU8` P00000NkvXXu0mjf7b1xE literal 0 HcmV?d00001 diff --git a/source/core/src/main/com/csse3200/game/components/mainmenu/MainMenuDisplay.java b/source/core/src/main/com/csse3200/game/components/mainmenu/MainMenuDisplay.java index 6f6d6623d..abdf962e2 100644 --- a/source/core/src/main/com/csse3200/game/components/mainmenu/MainMenuDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/mainmenu/MainMenuDisplay.java @@ -11,6 +11,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.csse3200.game.services.ServiceLocator; +import com.csse3200.game.ui.ButtonFactory; import com.csse3200.game.ui.UIComponent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,10 +59,21 @@ private void addActors() { title.setHeight(Gdx.graphics.getHeight()); title.setPosition(0, 0); - TextButton startBtn = new TextButton("Start", skin); - TextButton loadBtn = new TextButton("Help", skin); - TextButton settingsBtn = new TextButton("Settings", skin); - TextButton exitBtn = new TextButton("Quit", skin); + // Create an instance of the ButtonFactory class + ButtonFactory buttonFactory = new ButtonFactory(); + +// Create a "Start" TextButton using the default style + TextButton startBtn = buttonFactory.createButton("Start"); + +// Create a "Help" TextButton using the default style + TextButton loadBtn = buttonFactory.createButton("Help"); + +// Create a "Settings" TextButton with a custom image + TextButton settingsBtn = buttonFactory.createCustomButton("Settings", "images/ui/Sprites/UI_Glass_Button_Large_Lock_01a2.png"); + +// Create a "Quit" TextButton with a custom image + TextButton exitBtn = buttonFactory.createCustomButton("Quit", "images/ui/Sprites/UI_Glass_Button_Large_Press_01a2.png"); + // Triggers an event when the button is pressed startBtn.addListener( diff --git a/source/core/src/main/com/csse3200/game/ui/ButtonFactory.java b/source/core/src/main/com/csse3200/game/ui/ButtonFactory.java new file mode 100644 index 000000000..942da7c1a --- /dev/null +++ b/source/core/src/main/com/csse3200/game/ui/ButtonFactory.java @@ -0,0 +1,108 @@ +/** + * The ButtonFactory class is responsible for creating different types of TextButtons + * with customizable styles and properties for use in a LibGDX user interface. + */ +package com.csse3200.game.ui; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.TextureAtlas; +import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; + +/** + * This class provides methods for creating various types of TextButtons with different styles. + */ +public class ButtonFactory { + private Skin defaultSkin; + + /** + * Constructs a ButtonFactory and initializes the default skin. + */ + public ButtonFactory() { + defaultSkin = createDefaultSkin(); + } + + /** + * Creates a default skin for TextButtons using a JSON file for configuration. + * + * @return The default Skin object. + */ + private Skin createDefaultSkin() { + Skin skin = new Skin(Gdx.files.internal("configs/text.json")); + + // Load the background image for the default button style + TextureRegionDrawable buttonBackground = new TextureRegionDrawable( + new TextureRegion(new Texture("images/ui/Button_Bg.png")) + ); + + // Define the button style with the background image + TextButton.TextButtonStyle style = new TextButton.TextButtonStyle(); + style.font = skin.getFont("default"); + style.up = new TextureRegionDrawable(new TextureRegion(new Texture("images/ui/Sprites/UI_Glass_Button_Large_Lock_01a1.png"))); // Set the button background to the loaded image + + skin.add("default", style); + return skin; + } + + /** + * Creates a TextButton with the specified text using the default skin. + * + * @param text The text to display on the button. + * @return The created TextButton. + */ + public TextButton createButton(String text) { + TextButton button = new TextButton(text, defaultSkin); + button.getLabel().setFontScale(0.8f); // Adjust text size + button.pad(10f); // Adjust padding + return button; + } + + /** + * Creates a custom TextButton with the specified text and a custom image. + * + * @param text The text to display on the button. + * @param customImagePath The path to the custom image for the button. + * @return The created custom TextButton. + */ + public TextButton createCustomButton(String text, String customImagePath) { + // Create a custom button with a PNG image + Texture customTexture = new Texture(Gdx.files.internal(customImagePath)); + TextureRegionDrawable customDrawable = new TextureRegionDrawable(customTexture); + + TextButton.TextButtonStyle style = new TextButton.TextButtonStyle(); + style.font = defaultSkin.getFont("default"); + style.up = customDrawable; + + TextButton button = new TextButton(text, style); + button.getLabel().setFontScale(0.8f); // Adjust text size + button.pad(10f); // Adjust padding + + return button; + } + + /** + * Creates a custom TextButton with the specified text and an image from a TextureAtlas. + * + * @param text The text to display on the button. + * @param atlasPath The path to the TextureAtlas containing the button image. + * @return The created custom TextButton. + */ + public TextButton createCustomButtonWithAtlas(String text, String atlasPath) { + // Create a custom button with a TextureAtlas + TextureAtlas atlas = new TextureAtlas(Gdx.files.internal(atlasPath)); + Skin customSkin = new Skin(atlas); + + TextButton.TextButtonStyle style = new TextButton.TextButtonStyle(); + style.font = customSkin.getFont("default"); // for custom font if specified in the atlas + style.up = customSkin.getDrawable("button"); // for the button drawable from the atlas + + TextButton button = new TextButton(text, style); + button.getLabel().setFontScale(0.8f); // Adjust text size + button.pad(10f); // Adjust padding + + return button; + } +} From f262c86a47059b067bb45054772844a7e51defa1 Mon Sep 17 00:00:00 2001 From: Moksh Mehta Date: Tue, 19 Sep 2023 19:00:49 +1000 Subject: [PATCH 04/18] Added Cursor --- source/core/assets/images/ui/mouse_effect.png | Bin 881 -> 2167 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/source/core/assets/images/ui/mouse_effect.png b/source/core/assets/images/ui/mouse_effect.png index b9d818a24c908b274ed1284dd623d005dfb8e282..74d1ebce2a48c2e4833b20cba50976f23c90f71d 100644 GIT binary patch literal 2167 zcmZ{ldoqb>LHZk zrzOLW@kk?v+(s^A-P}^P)KBL*=Q-y&&w0-0d_M2W!osFS-Z03>Mx0F4d+!X1mY1ORbx01)5+09610s^p^QXRLM( zU_8dr4*2=2%37;)b{r|Hv#Y%nUq)H_7%aoi=+=(o<7{`*)3@{EkchOiexZCH_6cRQ_lo58~RUm3PL^aA0 znl!Q@4cp*brlMo7>l?Ye{nVO&v5mjEUGj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3jS`u%jf)pfVgpVQ=GtI40y;$Nu8dAs(e0000mbW%=J088NO z6+Z(9FjFD^)5hy>hYDi1^*8tQ;K|LhlC+zETPx}Q9HOD7|NsC0|NsB~;+0Nj0005# zNklb8t5Qg1FaltKaM@`If1j8n>38)|l1%IfZCVBriITBFDN>y&p%njB5 zN6&QsJ&DBsTDhO0T0T=NzOF$ z7@n?1SAWeRx23jzd$FT9)qfL2A^02zGA5_s|r zAPVgh2uyub7I=6N+W~dNnFdxlb=Wmktn1}4t->toNF;W5WOfLwiyV>G+n;ibE=h02N>O+YfW#P&OUoV_3XVuMU4Z|U57 vyTfiF_3P(TLm{ibKD?J#B>(% Date: Tue, 19 Sep 2023 23:53:12 +1000 Subject: [PATCH 05/18] Created asset loader --- .../csse3200/game/areas/ForestGameArea.java | 147 ++--------------- .../csse3200/game/screens/AssetLoader.java | 152 ++++++++++++++++++ 2 files changed, 167 insertions(+), 132 deletions(-) create mode 100644 source/core/src/main/com/csse3200/game/screens/AssetLoader.java diff --git a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java index 138e0e6d9..30a2b5234 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -12,6 +12,7 @@ import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.factories.*; import com.csse3200.game.physics.PhysicsLayer; +import com.csse3200.game.screens.AssetLoader; import com.csse3200.game.utils.math.RandomUtils; import com.csse3200.game.services.ResourceService; import com.csse3200.game.services.GameEndService; @@ -24,6 +25,7 @@ import static com.csse3200.game.entities.factories.NPCFactory.createGhost; +import static com.csse3200.game.screens.AssetLoader.loadAllAssets; import java.util.ArrayList; import java.util.TimerTask; @@ -35,7 +37,7 @@ public class ForestGameArea extends GameArea { private static final int NUM_GHOSTS = 0; private static final int NUM_GRUNTS = 5; private static final int NUM_BOSS = 4; - + private AssetLoader assetLoader; private static final int NUM_BOSSKING2=3; private static final int NUM_BOSSKING1=1; @@ -49,118 +51,8 @@ public class ForestGameArea extends GameArea { private static final GridPoint2 PLAYER_SPAWN = new GridPoint2(0, 0); // Temporary spawn point for testing private static final float WALL_WIDTH = 0.1f; - - // Required to load assets before using them - private static final String[] forestTextures = { - "images/desert_bg.png", - "images/ice_bg.png", - "images/lava_bg.png", - "images/projectiles/projectile.png", - "images/ingamebg.png", - "images/box_boy_leaf.png", - "images/background/building1.png", - "images/ghost_1.png", - "images/grass_2.png", - "images/grass_3.png", - "images/hex_grass_1.png", - "images/background/mountain.png", - "images/ghost_king.png", - "images/ghost_1.png", - "images/terrain 2 normal.png", - "images/terrain 2 hex.png", - "images/hex_grass_2.png", - "images/hex_grass_3.png", - "images/iso_grass_1.png", - "images/iso_grass_2.png", - "images/iso_grass_3.png", - "images/towers/turret.png", - "images/towers/turret01.png", - "images/towers/turret_deployed.png", - "images/towers/fire_tower_atlas.png", - "images/towers/stun_tower.png", - "images/background/building2.png", - "images/mobs/robot.png", - "images/mobs/boss2.png", - "images/mobs/Attack_1.png", - "images/mobs/Attack_2.png", - "images/mobs/Charge_1.png", - "images/mobs/Charge_2.png", - "images/mobs/Dead.png", - "images/mobs/Enabling-5.png", - "images/mobs/satyr.png", - "images/mobs/Hurt.png", - "images/mobs/Idle.png", - "images/mobs/rangeBossRight.png", - "images/towers/wallTower.png", - "images/background/building2.png", - "images/iso_grass_3.png", - "images/terrain_use.png", - "images/Dusty_MoonBG.png", - "images/economy/scrap.png", - "images/economy/crystal.png", - "images/economy/econ-tower.png", - "images/projectiles/bossProjectile.png", - "images/towers/mine_tower.png", - "images/towers/TNTTower.png", - "images/towers/DroidTower.png", - "images/projectiles/basic_projectile.png", - "images/projectiles/mobProjectile.png", - "images/projectiles/engineer_projectile.png", - "images/projectiles/mobKing_projectile.png", - "images/projectiles/snow_ball.png", - "images/projectiles/burn_effect.png", - "images/projectiles/stun_effect.png", - "images/projectiles/firework_anim.png", - "images/projectiles/pierce_anim.png", - "images/projectiles/snow_ball.png" - }; - private static final String[] forestTextureAtlases = { - "images/economy/econ-tower.atlas", - "images/terrain_iso_grass.atlas", - "images/ghost.atlas", - "images/mobs/boss2.atlas", - "images/ghostKing.atlas", - "images/towers/turret.atlas", - "images/towers/turret01.atlas", - "images/mobs/xenoGrunt.atlas", - "images/towers/fire_tower_atlas.atlas", - "images/towers/stun_tower.atlas", - "images/mobs/xenoGruntRunning.atlas", - "images/xenoGrunt.atlas", - "images/mobs/robot.atlas", - "images/mobs/rangeBossRight.atlas", - "images/towers/DroidTower.atlas", - "images/mobs/robot.atlas", - "images/mobs/rangeBossRight.atlas", - "images/towers/TNTTower.atlas", - "images/projectiles/basic_projectile.atlas", - "images/projectiles/bossProjectile.atlas", - "images/projectiles/mobProjectile.atlas", - "images/projectiles/mobProjectile.atlas", - "images/projectiles/engineer_projectile.atlas", - "images/projectiles/mobKing_projectile.atlas", - "images/projectiles/snow_ball.atlas", - "images/projectiles/pierce_anim.atlas", - "images/projectiles/burn_effect.atlas", - "images/projectiles/firework_anim.atlas", - "images/projectiles/mobProjectile.atlas", - "images/projectiles/stun_effect.atlas" - }; - private static final String[] forestSounds = { - "sounds/Impact4.ogg", - "sounds/economy/click.wav", - "sounds/economy/click_1.wav", - "sounds/towers/gun_shot_trimmed.mp3", - "sounds/towers/deploy.mp3", - "sounds/towers/stow.mp3", - "sounds/engineers/firing_auto.mp3", - "sounds/engineers/firing_single.mp3", - "sounds/projectiles/on_collision.mp3", - "sounds/projectiles/explosion.mp3" - }; private static final String backgroundMusic = "sounds/background/Sci-Fi1.ogg"; - private static final String[] forestMusic = {backgroundMusic}; - + private final TerrainFactory terrainFactory; private Entity player; @@ -181,6 +73,9 @@ public ForestGameArea(TerrainFactory terrainFactory) { super(); this.terrainFactory = terrainFactory; } + public void setAssetLoader(AssetLoader assetLoader) { + this.assetLoader = assetLoader; + } // Add this method to start the wave spawning timer when the game starts. private void startWaveTimer() { @@ -227,7 +122,7 @@ private void spawnWave() { @Override public void create() { // Load game assets - loadAssets(); + loadAllAssets(); displayUI(); spawnTerrain(); @@ -654,27 +549,15 @@ private void playMusic() { music.play(); } - private void loadAssets() { - logger.debug("Loading assets"); - ResourceService resourceService = ServiceLocator.getResourceService(); - resourceService.loadTextures(forestTextures); - resourceService.loadTextureAtlases(forestTextureAtlases); - resourceService.loadSounds(forestSounds); - resourceService.loadMusic(forestMusic); - - while (!resourceService.loadForMillis(10)) { - // This could be upgraded to a loading screen - logger.info("Loading... {}%", resourceService.getProgress()); - } - } - + + private void unloadAssets() { logger.debug("Unloading assets"); - ResourceService resourceService = ServiceLocator.getResourceService(); - resourceService.unloadAssets(forestTextures); - resourceService.unloadAssets(forestTextureAtlases); - resourceService.unloadAssets(forestSounds); - resourceService.unloadAssets(forestMusic); + if (assetLoader != null) { + AssetLoader.unloadAllAssets(); // Use the AssetLoader to unload assets if it's not null + } else { + logger.error("AssetLoader is not set. Cannot unload assets."); + } } @Override diff --git a/source/core/src/main/com/csse3200/game/screens/AssetLoader.java b/source/core/src/main/com/csse3200/game/screens/AssetLoader.java new file mode 100644 index 000000000..6bb3c18a9 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/screens/AssetLoader.java @@ -0,0 +1,152 @@ +package com.csse3200.game.screens; +import com.badlogic.gdx.audio.Music; +import com.badlogic.gdx.graphics.g2d.TextureAtlas; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.audio.Sound; +import com.csse3200.game.areas.ForestGameArea; +import com.csse3200.game.services.ResourceService; +import com.csse3200.game.services.ServiceLocator; + +public class AssetLoader { + // Define your asset file paths here + public static final String[] textures = { + "images/desert_bg.png", + "images/ice_bg.png", + "images/lava_bg.png", + "images/projectiles/projectile.png", + "images/ingamebg.png", + "images/box_boy_leaf.png", + "images/background/building1.png", + "images/ghost_1.png", + "images/grass_2.png", + "images/grass_3.png", + "images/hex_grass_1.png", + "images/background/mountain.png", + "images/ghost_king.png", + "images/ghost_1.png", + "images/terrain 2 normal.png", + "images/terrain 2 hex.png", + "images/hex_grass_2.png", + "images/hex_grass_3.png", + "images/iso_grass_1.png", + "images/iso_grass_2.png", + "images/iso_grass_3.png", + "images/towers/turret.png", + "images/towers/turret01.png", + "images/towers/turret_deployed.png", + "images/towers/fire_tower_atlas.png", + "images/towers/stun_tower.png", + "images/background/building2.png", + "images/mobs/robot.png", + "images/mobs/boss2.png", + "images/mobs/Attack_1.png", + "images/mobs/Attack_2.png", + "images/mobs/Charge_1.png", + "images/mobs/Charge_2.png", + "images/mobs/Dead.png", + "images/mobs/Enabling-5.png", + "images/mobs/satyr.png", + "images/mobs/Hurt.png", + "images/mobs/Idle.png", + "images/mobs/rangeBossRight.png", + "images/towers/wallTower.png", + "images/background/building2.png", + "images/iso_grass_3.png", + "images/terrain_use.png", + "images/Dusty_MoonBG.png", + "images/economy/scrap.png", + "images/economy/crystal.png", + "images/economy/econ-tower.png", + "images/projectiles/bossProjectile.png", + "images/towers/mine_tower.png", + "images/towers/TNTTower.png", + "images/towers/DroidTower.png", + "images/projectiles/basic_projectile.png", + "images/projectiles/mobProjectile.png", + "images/projectiles/engineer_projectile.png", + "images/projectiles/mobKing_projectile.png", + "images/projectiles/snow_ball.png", + "images/projectiles/burn_effect.png", + "images/projectiles/stun_effect.png", + "images/projectiles/firework_anim.png", + "images/projectiles/pierce_anim.png", + "images/projectiles/snow_ball.png" + }; + + public static final String[] textureAtlases = { + "images/economy/econ-tower.atlas", + "images/terrain_iso_grass.atlas", + "images/ghost.atlas", + "images/mobs/boss2.atlas", + "images/ghostKing.atlas", + "images/towers/turret.atlas", + "images/towers/turret01.atlas", + "images/mobs/xenoGrunt.atlas", + "images/towers/fire_tower_atlas.atlas", + "images/towers/stun_tower.atlas", + "images/mobs/xenoGruntRunning.atlas", + "images/xenoGrunt.atlas", + "images/mobs/robot.atlas", + "images/mobs/rangeBossRight.atlas", + "images/towers/DroidTower.atlas", + "images/mobs/robot.atlas", + "images/mobs/rangeBossRight.atlas", + "images/towers/TNTTower.atlas", + "images/projectiles/basic_projectile.atlas", + "images/projectiles/bossProjectile.atlas", + "images/projectiles/mobProjectile.atlas", + "images/projectiles/mobProjectile.atlas", + "images/projectiles/engineer_projectile.atlas", + "images/projectiles/mobKing_projectile.atlas", + "images/projectiles/snow_ball.atlas", + "images/projectiles/pierce_anim.atlas", + "images/projectiles/burn_effect.atlas", + "images/projectiles/firework_anim.atlas", + "images/projectiles/mobProjectile.atlas", + "images/projectiles/stun_effect.atlas" + }; + + + public static final String[] music = { + "sounds/background/Sci-Fi1.ogg" + }; + + public static final String[] Sounds = { + "sounds/Impact4.ogg", + "sounds/economy/click.wav", + "sounds/economy/click_1.wav", + "sounds/towers/gun_shot_trimmed.mp3", + "sounds/towers/deploy.mp3", + "sounds/towers/stow.mp3", + "sounds/engineers/firing_auto.mp3", + "sounds/engineers/firing_single.mp3", + "sounds/projectiles/on_collision.mp3", + "sounds/projectiles/explosion.mp3", + }; + + + public static void loadAllAssets() { + ResourceService resourceService = ServiceLocator.getResourceService(); + + resourceService.loadTextures(textures); + resourceService.loadTextureAtlases(textureAtlases); + resourceService.loadSounds(Sounds); + resourceService.loadMusic(music); + + // Wait for the assets to finish loading (you can implement a loading screen) + while (!resourceService.loadForMillis(10)) { + // Display loading progress if needed + } + } + + public static void unloadAllAssets() { + ResourceService resourceService = ServiceLocator.getResourceService(); + + resourceService.unloadAssets(textures); + resourceService.unloadAssets(textureAtlases); + resourceService.unloadAssets(Sounds); + resourceService.unloadAssets(music); + } + + // Add methods to access loaded assets as needed (e.g., getTexture, getSound, etc.) +} From 6cdb4ab3ddb7917243c7f0e8267f75048af1dfe5 Mon Sep 17 00:00:00 2001 From: MajorDzaster Date: Wed, 20 Sep 2023 11:00:38 +1000 Subject: [PATCH 06/18] Fixed typo in tower image loading process --- .../csse3200/game/components/gamearea/GameAreaDisplay.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/gamearea/GameAreaDisplay.java b/source/core/src/main/com/csse3200/game/components/gamearea/GameAreaDisplay.java index 27ace6b42..ed4750356 100644 --- a/source/core/src/main/com/csse3200/game/components/gamearea/GameAreaDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/gamearea/GameAreaDisplay.java @@ -87,7 +87,7 @@ public void create() { for (int i = 0; i < 2; i++) { // Use "building1" for the first tower and "building2" for the second tower skin.add("default", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); - skin.add("building1", new Texture("images/towers/WallTower.png")); + skin.add("building1", new Texture("images/towers/wallTower.png")); // Load textures for building1 and building2 towers1[i] = new Image(skin, "building1"); towers1[i].setBounds(Gdx.graphics.getWidth() * 40f / 100f, Gdx.graphics.getHeight() * 80f / 100f, 100, 100); @@ -142,7 +142,7 @@ public void touchUp(InputEvent event, float x, float y, int pointer, int button) for (int i = 0; i < 2; i++) { // Use "building1" for the first tower and "building2" for the second tower skin.add("default", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); - skin.add("building2", new Texture("images/towers/WallTower.png")); + skin.add("building2", new Texture("images/towers/wallTower.png")); towers2[i] = new Image(skin, "building2"); towers2[i].setBounds(Gdx.graphics.getWidth() * 50f / 100f, Gdx.graphics.getHeight() * 80f / 100f, 100, 100); stage.addActor(towers2[i]); From 7bf761f715b8d2504a0dd5d2d8c17c56ab8035c6 Mon Sep 17 00:00:00 2001 From: MajorDzaster Date: Thu, 21 Sep 2023 20:39:37 +1000 Subject: [PATCH 07/18] Added MainGamePauseDisplay as a component to the ui creation in MainGameScreen, creating a pause button in the top right of the game screen --- .../maingame/MainGamePauseDisplay.java | 60 +++++++++++++++++++ .../csse3200/game/screens/MainGameScreen.java | 12 ++-- 2 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java diff --git a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java new file mode 100644 index 000000000..2fe4246f2 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java @@ -0,0 +1,60 @@ +package com.csse3200.game.components.maingame; + +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.csse3200.game.ui.UIComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class MainGamePauseDisplay extends UIComponent { + private static final Logger logger = LoggerFactory.getLogger(MainGameExitDisplay.class); + private static final float Z_INDEX = 2f; + private Table table; + + @Override + public void create() { + super.create(); + addActors(); + } + + private void addActors() { + table = new Table(); + table.top().right(); + table.setFillParent(true); + + TextButton mainMenuBtn = new TextButton("Pause", skin); + + // Triggers an event when the button is pressed. + mainMenuBtn.addListener( + new ChangeListener() { + @Override + public void changed(ChangeEvent changeEvent, Actor actor) { + logger.debug("Pause button clicked"); + entity.getEvents().trigger("pause"); + } + }); + + table.add(mainMenuBtn).padTop(100f).padRight(10f); + + stage.addActor(table); + } + + @Override + public void draw(SpriteBatch batch) { + // draw is handled by the stage + } + + @Override + public float getZIndex() { + return Z_INDEX; + } + + @Override + public void dispose() { + table.clear(); + super.dispose(); + } +} diff --git a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java index ab475797f..216778586 100644 --- a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java @@ -22,6 +22,7 @@ import com.csse3200.game.components.gamearea.PerformanceDisplay; import com.csse3200.game.components.maingame.MainGameActions; import com.csse3200.game.components.maingame.MainGameLoseDisplay; +import com.csse3200.game.components.maingame.MainGamePauseDisplay; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.EntityService; import com.csse3200.game.entities.factories.PlayerFactory; @@ -198,12 +199,13 @@ private void createUI() { ui = new Entity(); ui.addComponent(new InputDecorator(stage, 10)) .addComponent(new PerformanceDisplay()) - .addComponent(new MainGameActions(this.game)) - .addComponent(new MainGameExitDisplay()) + .addComponent(new MainGameActions(this.game)) + .addComponent(new MainGameExitDisplay()) .addComponent(new MainGameLoseDisplay()) - .addComponent(new Terminal()) - .addComponent(inputComponent) - .addComponent(new TerminalDisplay()); + .addComponent(new MainGamePauseDisplay()) + .addComponent(new Terminal()) + .addComponent(inputComponent) + .addComponent(new TerminalDisplay()); ServiceLocator.getEntityService().register(ui); } From b43162abde32c2d6bceae13918f30c6b2feb270c Mon Sep 17 00:00:00 2001 From: MajorDzaster Date: Thu, 21 Sep 2023 21:20:04 +1000 Subject: [PATCH 08/18] Added PauseMenuContinueButton, PauseMenuSettingsButton, PauseMenuPlanetSelectButton, PauseMenuMainMenuButton, PauseMenuTimeStopComponent and PauseMenuRenderComponent to act as components for a pause menu entity. These components do nothing presently, and the pause menu entity is not implemented yet. --- .../components/maingame/MainGamePauseDisplay.java | 3 +++ .../pausemenu/PauseMenuContinueButton.java | 14 ++++++++++++++ .../pausemenu/PauseMenuMainMenuButton.java | 14 ++++++++++++++ .../pausemenu/PauseMenuPlanetSelectButton.java | 14 ++++++++++++++ .../pausemenu/PauseMenuRenderComponent.java | 14 ++++++++++++++ .../pausemenu/PauseMenuSettingsButton.java | 14 ++++++++++++++ .../pausemenu/PauseMenuTimeStopComponent.java | 9 +++++++++ .../com/csse3200/game/screens/MainGameScreen.java | 1 - 8 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuContinueButton.java create mode 100644 source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java create mode 100644 source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java create mode 100644 source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuRenderComponent.java create mode 100644 source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java create mode 100644 source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java diff --git a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java index 2fe4246f2..7d017e207 100644 --- a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java @@ -9,6 +9,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * Displays a button to pause the game and bring up a pause menu. + */ public class MainGamePauseDisplay extends UIComponent { private static final Logger logger = LoggerFactory.getLogger(MainGameExitDisplay.class); private static final float Z_INDEX = 2f; diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuContinueButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuContinueButton.java new file mode 100644 index 000000000..6aa3e7696 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuContinueButton.java @@ -0,0 +1,14 @@ +package com.csse3200.game.components.pausemenu; + +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.csse3200.game.ui.UIComponent; + +/** + * Displays a button in the pause menu to resume the game and put away the pause menu. + */ +public class PauseMenuContinueButton extends UIComponent { + @Override + public void draw(SpriteBatch batch) { + // draw is handled by the renderer component + } +} diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java new file mode 100644 index 000000000..29ed29d11 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java @@ -0,0 +1,14 @@ +package com.csse3200.game.components.pausemenu; + +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.csse3200.game.ui.UIComponent; + +/** + * Displays a button in the pause menu to return to the main menu screen. + */ +public class PauseMenuMainMenuButton extends UIComponent { + @Override + public void draw(SpriteBatch batch) { + // draw is handled by the renderer component + } +} diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java new file mode 100644 index 000000000..e12dc2a5e --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java @@ -0,0 +1,14 @@ +package com.csse3200.game.components.pausemenu; + +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.csse3200.game.ui.UIComponent; + +/** + * Displays a button in the pause menu to return to the planet select screen. + */ +public class PauseMenuPlanetSelectButton extends UIComponent { + @Override + public void draw(SpriteBatch batch) { + // draw is handled by the renderer component + } +} diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuRenderComponent.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuRenderComponent.java new file mode 100644 index 000000000..078d13755 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuRenderComponent.java @@ -0,0 +1,14 @@ +package com.csse3200.game.components.pausemenu; + +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.csse3200.game.rendering.RenderComponent; + +/** + * Handles the rendering and de-rendering of the pause menu. + */ +public class PauseMenuRenderComponent extends RenderComponent { + @Override + public void draw(SpriteBatch batch) { + // TO DO: Actually make this function + } +} diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java new file mode 100644 index 000000000..df7174ba7 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java @@ -0,0 +1,14 @@ +package com.csse3200.game.components.pausemenu; + +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.csse3200.game.ui.UIComponent; + +/** + * Displays a button in the pause menu to open the game settings. + */ +public class PauseMenuSettingsButton extends UIComponent { + @Override + public void draw(SpriteBatch batch) { + // draw is handled by the renderer component + } +} diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java new file mode 100644 index 000000000..0b706224f --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java @@ -0,0 +1,9 @@ +package com.csse3200.game.components.pausemenu; + +import com.csse3200.game.components.Component; + +/** + * ZA WARUDO + */ +public class PauseMenuTimeStopComponent extends Component { +} diff --git a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java index 216778586..651b031d7 100644 --- a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java @@ -206,7 +206,6 @@ private void createUI() { .addComponent(new Terminal()) .addComponent(inputComponent) .addComponent(new TerminalDisplay()); - ServiceLocator.getEntityService().register(ui); } } From 0f9f0d6b44b73853363b8d86b3668ec651fcd44a Mon Sep 17 00:00:00 2001 From: MajorDzaster Date: Fri, 22 Sep 2023 16:09:52 +1000 Subject: [PATCH 09/18] Added PauseMenuFactory to allow the creation of the pause menu entity. Added functionality to PauseMenuStopTimeComponent to stop time when created, and resume time when disposed. Added functionality to MainGamePauseDisplay to create a pause menu entity when the pause button is clicked. --- .../maingame/MainGamePauseDisplay.java | 6 ++++- .../pausemenu/PauseMenuTimeStopComponent.java | 15 ++++++++++- .../entities/factories/PauseMenuFactory.java | 26 +++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java diff --git a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java index 7d017e207..cd00e4e6b 100644 --- a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java @@ -5,6 +5,8 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.factories.PauseMenuFactory; import com.csse3200.game.ui.UIComponent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -17,6 +19,8 @@ public class MainGamePauseDisplay extends UIComponent { private static final float Z_INDEX = 2f; private Table table; + private Entity pauseMenu; + @Override public void create() { super.create(); @@ -36,7 +40,7 @@ private void addActors() { @Override public void changed(ChangeEvent changeEvent, Actor actor) { logger.debug("Pause button clicked"); - entity.getEvents().trigger("pause"); + PauseMenuFactory.createPauseMenu(); } }); diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java index 0b706224f..7871fbe94 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java @@ -1,9 +1,22 @@ package com.csse3200.game.components.pausemenu; import com.csse3200.game.components.Component; +import com.csse3200.game.services.ServiceLocator; /** - * ZA WARUDO + * Handles the pausing/resuming of time when the pause menu is brought up/put away. */ public class PauseMenuTimeStopComponent extends Component { + public PauseMenuTimeStopComponent() { + } + + @Override + public void create() { + ServiceLocator.getTimeSource().setTimeScale(0f); + } + + @Override + public void dispose() { + ServiceLocator.getTimeSource().setTimeScale(1f); + } } diff --git a/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java new file mode 100644 index 000000000..a7a8caa2b --- /dev/null +++ b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java @@ -0,0 +1,26 @@ +package com.csse3200.game.entities.factories; + +import com.csse3200.game.components.pausemenu.*; +import com.csse3200.game.entities.Entity; + +/** + * Factory to create the pause menu and attach its components. + */ +public class PauseMenuFactory { + + /** + * Creates the pause menu + * @return entity + */ + public static Entity createPauseMenu() { + Entity pauseMenu = new Entity() + .addComponent(new PauseMenuTimeStopComponent()) + .addComponent(new PauseMenuRenderComponent()) + .addComponent(new PauseMenuContinueButton()) + .addComponent(new PauseMenuSettingsButton()) + .addComponent(new PauseMenuPlanetSelectButton()) + .addComponent(new PauseMenuMainMenuButton()); + pauseMenu.create(); + return pauseMenu; + } +} From bf18b01f9fc63e08e4234c063acf22e393507108 Mon Sep 17 00:00:00 2001 From: MajorDzaster Date: Sat, 23 Sep 2023 10:13:39 +1000 Subject: [PATCH 10/18] PauseMenuFactory now registers the created entity with EntityService. --- .../com/csse3200/game/entities/factories/PauseMenuFactory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java index a7a8caa2b..4d244ec2f 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java @@ -2,6 +2,7 @@ import com.csse3200.game.components.pausemenu.*; import com.csse3200.game.entities.Entity; +import com.csse3200.game.services.ServiceLocator; /** * Factory to create the pause menu and attach its components. @@ -20,7 +21,7 @@ public static Entity createPauseMenu() { .addComponent(new PauseMenuSettingsButton()) .addComponent(new PauseMenuPlanetSelectButton()) .addComponent(new PauseMenuMainMenuButton()); - pauseMenu.create(); + ServiceLocator.getEntityService().register(pauseMenu); return pauseMenu; } } From e0f2eb16eb32f6bd50caab92a3a84ef62432454d Mon Sep 17 00:00:00 2001 From: MajorDzaster Date: Sun, 24 Sep 2023 17:05:14 +1000 Subject: [PATCH 11/18] Implemented pause menu button classes. Have not implemented renderer component or screen change functionality. --- .../maingame/MainGamePauseDisplay.java | 6 +-- .../pausemenu/PauseMenuContinueButton.java | 52 +++++++++++++++++++ .../pausemenu/PauseMenuMainMenuButton.java | 49 +++++++++++++++++ .../PauseMenuPlanetSelectButton.java | 49 +++++++++++++++++ .../pausemenu/PauseMenuSettingsButton.java | 49 +++++++++++++++++ 5 files changed, 201 insertions(+), 4 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java index cd00e4e6b..b87877aa2 100644 --- a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java @@ -15,12 +15,10 @@ * Displays a button to pause the game and bring up a pause menu. */ public class MainGamePauseDisplay extends UIComponent { - private static final Logger logger = LoggerFactory.getLogger(MainGameExitDisplay.class); + private static final Logger logger = LoggerFactory.getLogger(MainGamePauseDisplay.class); private static final float Z_INDEX = 2f; private Table table; - private Entity pauseMenu; - @Override public void create() { super.create(); @@ -34,7 +32,7 @@ private void addActors() { TextButton mainMenuBtn = new TextButton("Pause", skin); - // Triggers an event when the button is pressed. + // Spawns a pause menu when the button is pressed. mainMenuBtn.addListener( new ChangeListener() { @Override diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuContinueButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuContinueButton.java index 6aa3e7696..8ad9d878c 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuContinueButton.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuContinueButton.java @@ -1,14 +1,66 @@ package com.csse3200.game.components.pausemenu; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.csse3200.game.components.maingame.MainGamePauseDisplay; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.factories.PauseMenuFactory; import com.csse3200.game.ui.UIComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Displays a button in the pause menu to resume the game and put away the pause menu. */ public class PauseMenuContinueButton extends UIComponent { + private static final Logger logger = LoggerFactory.getLogger(PauseMenuContinueButton.class); + private static final float Z_INDEX = 2f; + private Table table; + + @Override + public void create() { + super.create(); + addActors(); + } + + private void addActors() { + table = new Table(); + table.top().right(); + table.setFillParent(true); + + TextButton pauseMenuBtn = new TextButton("Continue", skin); + + // Triggers an event when the button is pressed. + pauseMenuBtn.addListener( + new ChangeListener() { + @Override + public void changed(ChangeEvent changeEvent, Actor actor) { + logger.debug("Continue button clicked"); + entity.dispose(); + } + }); + + table.add(pauseMenuBtn).padTop(300f).padRight(500f); + + stage.addActor(table); + } + @Override public void draw(SpriteBatch batch) { // draw is handled by the renderer component } + + @Override + public float getZIndex() { + return Z_INDEX; + } + + @Override + public void dispose() { + table.clear(); + super.dispose(); + } } diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java index 29ed29d11..2f26c7b98 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java @@ -1,14 +1,63 @@ package com.csse3200.game.components.pausemenu; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.csse3200.game.ui.UIComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Displays a button in the pause menu to return to the main menu screen. */ public class PauseMenuMainMenuButton extends UIComponent { + private static final Logger logger = LoggerFactory.getLogger(PauseMenuMainMenuButton.class); + private static final float Z_INDEX = 2f; + private Table table; + + @Override + public void create() { + super.create(); + addActors(); + } + + private void addActors() { + table = new Table(); + table.top().right(); + table.setFillParent(true); + + TextButton pauseMenuBtn = new TextButton("Main Menu", skin); + + // Triggers an event when the button is pressed. + pauseMenuBtn.addListener( + new ChangeListener() { + @Override + public void changed(ChangeEvent changeEvent, Actor actor) { + logger.debug("Main menu button clicked"); + // open settings + } + }); + + table.add(pauseMenuBtn).padTop(400f).padRight(400f); + + stage.addActor(table); + } + @Override public void draw(SpriteBatch batch) { // draw is handled by the renderer component } + + @Override + public float getZIndex() { + return Z_INDEX; + } + + @Override + public void dispose() { + table.clear(); + super.dispose(); + } } diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java index e12dc2a5e..0ad08d5c0 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java @@ -1,14 +1,63 @@ package com.csse3200.game.components.pausemenu; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.csse3200.game.ui.UIComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Displays a button in the pause menu to return to the planet select screen. */ public class PauseMenuPlanetSelectButton extends UIComponent { + private static final Logger logger = LoggerFactory.getLogger(PauseMenuPlanetSelectButton.class); + private static final float Z_INDEX = 2f; + private Table table; + + @Override + public void create() { + super.create(); + addActors(); + } + + private void addActors() { + table = new Table(); + table.top().right(); + table.setFillParent(true); + + TextButton pauseMenuBtn = new TextButton("Planet Select", skin); + + // Triggers an event when the button is pressed. + pauseMenuBtn.addListener( + new ChangeListener() { + @Override + public void changed(ChangeEvent changeEvent, Actor actor) { + logger.debug("Planet select button clicked"); + // open settings + } + }); + + table.add(pauseMenuBtn).padTop(400f).padRight(500f); + + stage.addActor(table); + } + @Override public void draw(SpriteBatch batch) { // draw is handled by the renderer component } + + @Override + public float getZIndex() { + return Z_INDEX; + } + + @Override + public void dispose() { + table.clear(); + super.dispose(); + } } diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java index df7174ba7..a82f0f957 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java @@ -1,14 +1,63 @@ package com.csse3200.game.components.pausemenu; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.csse3200.game.ui.UIComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Displays a button in the pause menu to open the game settings. */ public class PauseMenuSettingsButton extends UIComponent { + private static final Logger logger = LoggerFactory.getLogger(PauseMenuSettingsButton.class); + private static final float Z_INDEX = 2f; + private Table table; + + @Override + public void create() { + super.create(); + addActors(); + } + + private void addActors() { + table = new Table(); + table.top().right(); + table.setFillParent(true); + + TextButton pauseMenuBtn = new TextButton("Settings", skin); + + // Triggers an event when the button is pressed. + pauseMenuBtn.addListener( + new ChangeListener() { + @Override + public void changed(ChangeEvent changeEvent, Actor actor) { + logger.debug("Settings button clicked"); + // open settings + } + }); + + table.add(pauseMenuBtn).padTop(300f).padRight(400f); + + stage.addActor(table); + } + @Override public void draw(SpriteBatch batch) { // draw is handled by the renderer component } + + @Override + public float getZIndex() { + return Z_INDEX; + } + + @Override + public void dispose() { + table.clear(); + super.dispose(); + } } From 29192a8bae4c8d84b9e63280410e8611a73a5c5a Mon Sep 17 00:00:00 2001 From: MajorDzaster Date: Mon, 25 Sep 2023 11:30:49 +1000 Subject: [PATCH 12/18] Implemented pausing the game in PauseMenuTimeStopComponent via disabling the entities on screen. Does not yet handle incoming waves. --- .../pausemenu/PauseMenuTimeStopComponent.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java index 7871fbe94..285fad8e2 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java @@ -1,22 +1,40 @@ package com.csse3200.game.components.pausemenu; import com.csse3200.game.components.Component; +import com.csse3200.game.entities.Entity; +import com.badlogic.gdx.utils.Array; import com.csse3200.game.services.ServiceLocator; /** * Handles the pausing/resuming of time when the pause menu is brought up/put away. */ public class PauseMenuTimeStopComponent extends Component { + + private Array freezeList; public PauseMenuTimeStopComponent() { } + /** + * Handles the pausing of the game entities when the pause menu is made. + */ @Override public void create() { - ServiceLocator.getTimeSource().setTimeScale(0f); + freezeList = ServiceLocator.getEntityService().getEntities(); + for (Entity pauseTarget : freezeList) { + if (pauseTarget.getId() != getEntity().getId()) { + // ZA WARUDO! TOKI WO TOMARE! + pauseTarget.setEnabled(false); + } + } } + /** + * Handles the un-pausing of the game entities when the pause menu is closed. + */ @Override public void dispose() { - ServiceLocator.getTimeSource().setTimeScale(1f); + for (Entity pauseTarget : freezeList) { + pauseTarget.setEnabled(true); + } } } From fb25a74bccefe445334de5d8980dd06263f0362e Mon Sep 17 00:00:00 2001 From: MajorDzaster Date: Mon, 25 Sep 2023 13:23:43 +1000 Subject: [PATCH 13/18] Added screen change functionality to pause menu buttons. Noted some crash issues re-entering the level. --- .../game/components/maingame/MainGamePauseDisplay.java | 9 ++++++++- .../components/pausemenu/PauseMenuMainMenuButton.java | 10 +++++++++- .../pausemenu/PauseMenuPlanetSelectButton.java | 10 +++++++++- .../components/pausemenu/PauseMenuSettingsButton.java | 10 +++++++++- .../game/entities/factories/PauseMenuFactory.java | 9 +++++---- .../main/com/csse3200/game/screens/MainGameScreen.java | 2 +- 6 files changed, 41 insertions(+), 9 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java index b87877aa2..eb8a0b273 100644 --- a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java @@ -5,6 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.csse3200.game.GdxGame; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.factories.PauseMenuFactory; import com.csse3200.game.ui.UIComponent; @@ -19,6 +20,12 @@ public class MainGamePauseDisplay extends UIComponent { private static final float Z_INDEX = 2f; private Table table; + private GdxGame game; + + public MainGamePauseDisplay(GdxGame screenSwitchHandle) { + game = screenSwitchHandle; + } + @Override public void create() { super.create(); @@ -38,7 +45,7 @@ private void addActors() { @Override public void changed(ChangeEvent changeEvent, Actor actor) { logger.debug("Pause button clicked"); - PauseMenuFactory.createPauseMenu(); + PauseMenuFactory.createPauseMenu(game); } }); diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java index 2f26c7b98..9b8dd208d 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java @@ -1,10 +1,13 @@ package com.csse3200.game.components.pausemenu; +import com.badlogic.gdx.Game; +import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.csse3200.game.GdxGame; import com.csse3200.game.ui.UIComponent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -17,6 +20,11 @@ public class PauseMenuMainMenuButton extends UIComponent { private static final float Z_INDEX = 2f; private Table table; + private final GdxGame game; + + public PauseMenuMainMenuButton(GdxGame screenSwitchHandle) { + game = screenSwitchHandle; + } @Override public void create() { super.create(); @@ -36,7 +44,7 @@ private void addActors() { @Override public void changed(ChangeEvent changeEvent, Actor actor) { logger.debug("Main menu button clicked"); - // open settings + game.setScreen(GdxGame.ScreenType.MAIN_MENU); } }); diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java index 0ad08d5c0..f5d19f1bf 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java @@ -1,10 +1,13 @@ package com.csse3200.game.components.pausemenu; +import com.badlogic.gdx.Game; +import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.csse3200.game.GdxGame; import com.csse3200.game.ui.UIComponent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -17,6 +20,11 @@ public class PauseMenuPlanetSelectButton extends UIComponent { private static final float Z_INDEX = 2f; private Table table; + private final GdxGame game; + + public PauseMenuPlanetSelectButton(GdxGame screenSwitchHandle) { + game = screenSwitchHandle; + } @Override public void create() { super.create(); @@ -36,7 +44,7 @@ private void addActors() { @Override public void changed(ChangeEvent changeEvent, Actor actor) { logger.debug("Planet select button clicked"); - // open settings + game.setScreen(GdxGame.ScreenType.LEVEL_SELECT); } }); diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java index a82f0f957..4338b57b6 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java @@ -1,10 +1,12 @@ package com.csse3200.game.components.pausemenu; +import com.badlogic.gdx.Game; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.csse3200.game.GdxGame; import com.csse3200.game.ui.UIComponent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -17,6 +19,12 @@ public class PauseMenuSettingsButton extends UIComponent { private static final float Z_INDEX = 2f; private Table table; + private final GdxGame game; + + public PauseMenuSettingsButton(GdxGame screenSwitchHandle) { + game = screenSwitchHandle; + } + @Override public void create() { super.create(); @@ -36,7 +44,7 @@ private void addActors() { @Override public void changed(ChangeEvent changeEvent, Actor actor) { logger.debug("Settings button clicked"); - // open settings + game.setScreen(GdxGame.ScreenType.SETTINGS); } }); diff --git a/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java index 4d244ec2f..fdb3a4204 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java @@ -1,5 +1,6 @@ package com.csse3200.game.entities.factories; +import com.csse3200.game.GdxGame; import com.csse3200.game.components.pausemenu.*; import com.csse3200.game.entities.Entity; import com.csse3200.game.services.ServiceLocator; @@ -13,14 +14,14 @@ public class PauseMenuFactory { * Creates the pause menu * @return entity */ - public static Entity createPauseMenu() { + public static Entity createPauseMenu(GdxGame game) { Entity pauseMenu = new Entity() .addComponent(new PauseMenuTimeStopComponent()) .addComponent(new PauseMenuRenderComponent()) .addComponent(new PauseMenuContinueButton()) - .addComponent(new PauseMenuSettingsButton()) - .addComponent(new PauseMenuPlanetSelectButton()) - .addComponent(new PauseMenuMainMenuButton()); + .addComponent(new PauseMenuSettingsButton(game)) + .addComponent(new PauseMenuPlanetSelectButton(game)) + .addComponent(new PauseMenuMainMenuButton(game)); ServiceLocator.getEntityService().register(pauseMenu); return pauseMenu; } diff --git a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java index 651b031d7..a56755b6e 100644 --- a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java @@ -202,7 +202,7 @@ private void createUI() { .addComponent(new MainGameActions(this.game)) .addComponent(new MainGameExitDisplay()) .addComponent(new MainGameLoseDisplay()) - .addComponent(new MainGamePauseDisplay()) + .addComponent(new MainGamePauseDisplay(this.game)) .addComponent(new Terminal()) .addComponent(inputComponent) .addComponent(new TerminalDisplay()); From 42179a4db68dfbec315299bf3d41475970364572 Mon Sep 17 00:00:00 2001 From: MajorDzaster Date: Thu, 28 Sep 2023 09:14:46 +1000 Subject: [PATCH 14/18] Adjusted location of pause menu buttons to fit center of screen better. --- .../game/components/pausemenu/PauseMenuContinueButton.java | 2 +- .../game/components/pausemenu/PauseMenuMainMenuButton.java | 2 +- .../game/components/pausemenu/PauseMenuPlanetSelectButton.java | 2 +- .../game/components/pausemenu/PauseMenuSettingsButton.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuContinueButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuContinueButton.java index 8ad9d878c..f18659c05 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuContinueButton.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuContinueButton.java @@ -43,7 +43,7 @@ public void changed(ChangeEvent changeEvent, Actor actor) { } }); - table.add(pauseMenuBtn).padTop(300f).padRight(500f); + table.add(pauseMenuBtn).padTop(300f).padRight(700f); stage.addActor(table); } diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java index 9b8dd208d..e5edb5b25 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuMainMenuButton.java @@ -48,7 +48,7 @@ public void changed(ChangeEvent changeEvent, Actor actor) { } }); - table.add(pauseMenuBtn).padTop(400f).padRight(400f); + table.add(pauseMenuBtn).padTop(400f).padRight(490f); stage.addActor(table); } diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java index f5d19f1bf..d8ab32a45 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuPlanetSelectButton.java @@ -48,7 +48,7 @@ public void changed(ChangeEvent changeEvent, Actor actor) { } }); - table.add(pauseMenuBtn).padTop(400f).padRight(500f); + table.add(pauseMenuBtn).padTop(400f).padRight(675f); stage.addActor(table); } diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java index 4338b57b6..c89a2c8b9 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuSettingsButton.java @@ -48,7 +48,7 @@ public void changed(ChangeEvent changeEvent, Actor actor) { } }); - table.add(pauseMenuBtn).padTop(300f).padRight(400f); + table.add(pauseMenuBtn).padTop(300f).padRight(500f); stage.addActor(table); } From e0957973bdbd1b9fdb0f827d961f28fccdb59601 Mon Sep 17 00:00:00 2001 From: MajorDzaster Date: Thu, 28 Sep 2023 09:48:17 +1000 Subject: [PATCH 15/18] Implemented the wave timer pausing when the pause menu is opened. ISSUE: The wave timer entity isn't present in MainGameScreen, so it can't be passed to the pause menu at present. Fixing this is the next objective for this task. --- .../maingame/MainGamePauseDisplay.java | 7 +++--- .../pausemenu/PauseMenuTimeStopComponent.java | 11 +++++++- .../game/components/tasks/SpawnWaveTask.java | 25 ++++++++++++++++--- .../entities/factories/PauseMenuFactory.java | 6 +++-- .../csse3200/game/screens/MainGameScreen.java | 5 +++- 5 files changed, 44 insertions(+), 10 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java index eb8a0b273..cf2f129ed 100644 --- a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java @@ -19,11 +19,12 @@ public class MainGamePauseDisplay extends UIComponent { private static final Logger logger = LoggerFactory.getLogger(MainGamePauseDisplay.class); private static final float Z_INDEX = 2f; private Table table; - private GdxGame game; + private Entity waveSpawner; - public MainGamePauseDisplay(GdxGame screenSwitchHandle) { + public MainGamePauseDisplay(GdxGame screenSwitchHandle, Entity waveSpawner) { game = screenSwitchHandle; + this.waveSpawner = waveSpawner; } @Override @@ -45,7 +46,7 @@ private void addActors() { @Override public void changed(ChangeEvent changeEvent, Actor actor) { logger.debug("Pause button clicked"); - PauseMenuFactory.createPauseMenu(game); + PauseMenuFactory.createPauseMenu(game, waveSpawner); } }); diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java index 285fad8e2..6503add30 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java @@ -11,7 +11,14 @@ public class PauseMenuTimeStopComponent extends Component { private Array freezeList; - public PauseMenuTimeStopComponent() { + private Entity waveSpawner; + + /** + * Initialises the component. + * @param waveSpawner The entity that controls the wave spawning timer. + */ + public PauseMenuTimeStopComponent(Entity waveSpawner) { + this.waveSpawner = waveSpawner; } /** @@ -19,6 +26,7 @@ public PauseMenuTimeStopComponent() { */ @Override public void create() { + waveSpawner.getEvents().trigger("toggleWaveTimer"); freezeList = ServiceLocator.getEntityService().getEntities(); for (Entity pauseTarget : freezeList) { if (pauseTarget.getId() != getEntity().getId()) { @@ -33,6 +41,7 @@ public void create() { */ @Override public void dispose() { + waveSpawner.getEvents().trigger("toggleWaveTimer"); for (Entity pauseTarget : freezeList) { pauseTarget.setEnabled(true); } diff --git a/source/core/src/main/com/csse3200/game/components/tasks/SpawnWaveTask.java b/source/core/src/main/com/csse3200/game/components/tasks/SpawnWaveTask.java index d6c4a3d85..4150363aa 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/SpawnWaveTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/SpawnWaveTask.java @@ -12,6 +12,8 @@ public class SpawnWaveTask extends DefaultTask implements PriorityTask { private final GameTime globalTime; private long endTime = 0; private final int SPAWNING_INTERVAL = 10; + private boolean wavesPaused = false; + private long pauseTime = 0; public SpawnWaveTask() { this.globalTime = ServiceLocator.getTimeSource(); } @@ -25,13 +27,30 @@ public int getPriority() { public void start() { super.start(); endTime = globalTime.getTime() + (SPAWNING_INTERVAL * 1000); + this.owner.getEntity().getEvents().addListener("toggleWaveTimer", this::toggleWaveTimer); } @Override public void update() { - if (globalTime.getTime() >= endTime) { - this.owner.getEntity().getEvents().trigger("spawnWave"); - endTime = globalTime.getTime() + (SPAWNING_INTERVAL * 1000L); // reset end time + if (!wavesPaused) { + if (globalTime.getTime() >= endTime) { + this.owner.getEntity().getEvents().trigger("spawnWave"); + endTime = globalTime.getTime() + (SPAWNING_INTERVAL * 1000L); // reset end time + } + } + } + + /** + * Function for pausing the wave timer when the pause menu is opened, and resuming it when the pause menu is closed. + */ + private void toggleWaveTimer() { + if (!wavesPaused) { + pauseTime = globalTime.getTime(); + wavesPaused = true; + } else { + // Offsets the next wave spawn by however long the game was paused. + endTime += globalTime.getTime() - pauseTime; + wavesPaused = false; } } } diff --git a/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java index fdb3a4204..bfd524ee7 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java @@ -12,11 +12,13 @@ public class PauseMenuFactory { /** * Creates the pause menu + * @param game The Gdx game instance that handles screen changes. + * @param waveSpawner The entity that handles the wave spawn timer * @return entity */ - public static Entity createPauseMenu(GdxGame game) { + public static Entity createPauseMenu(GdxGame game, Entity waveSpawner) { Entity pauseMenu = new Entity() - .addComponent(new PauseMenuTimeStopComponent()) + .addComponent(new PauseMenuTimeStopComponent(waveSpawner)) .addComponent(new PauseMenuRenderComponent()) .addComponent(new PauseMenuContinueButton()) .addComponent(new PauseMenuSettingsButton(game)) diff --git a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java index a56755b6e..77bdd47ea 100644 --- a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java @@ -202,7 +202,10 @@ private void createUI() { .addComponent(new MainGameActions(this.game)) .addComponent(new MainGameExitDisplay()) .addComponent(new MainGameLoseDisplay()) - .addComponent(new MainGamePauseDisplay(this.game)) + // WHERE'S THE WAVE SPAWNER, HOW IS THIS GAME FUNCTIONING WHEN IT DOESN'T EVEN MAKE A WAVE SPAWNER + // I'm told there's a new entity for the SpawnWaveTask, maybe it'll actually be accessible in this class. + // fyi there REALLY shouldn't be a null arg, but I need to push this before I can fix the issue. + .addComponent(new MainGamePauseDisplay(this.game, null)) .addComponent(new Terminal()) .addComponent(inputComponent) .addComponent(new TerminalDisplay()); From c1b69da322e62a508c990180fe7c9c547f3f9207 Mon Sep 17 00:00:00 2001 From: MajorDzaster Date: Thu, 28 Sep 2023 18:30:36 +1000 Subject: [PATCH 16/18] Revert "Implemented the wave timer pausing when the pause menu is opened. ISSUE: The wave timer entity isn't present in MainGameScreen, so it can't be passed to the pause menu at present. Fixing this is the next objective for this task." This reverts commit e0957973bdbd1b9fdb0f827d961f28fccdb59601. --- .../maingame/MainGamePauseDisplay.java | 7 +++--- .../pausemenu/PauseMenuTimeStopComponent.java | 11 +------- .../game/components/tasks/SpawnWaveTask.java | 25 +++---------------- .../entities/factories/PauseMenuFactory.java | 6 ++--- .../csse3200/game/screens/MainGameScreen.java | 5 +--- 5 files changed, 10 insertions(+), 44 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java index cf2f129ed..eb8a0b273 100644 --- a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java @@ -19,12 +19,11 @@ public class MainGamePauseDisplay extends UIComponent { private static final Logger logger = LoggerFactory.getLogger(MainGamePauseDisplay.class); private static final float Z_INDEX = 2f; private Table table; + private GdxGame game; - private Entity waveSpawner; - public MainGamePauseDisplay(GdxGame screenSwitchHandle, Entity waveSpawner) { + public MainGamePauseDisplay(GdxGame screenSwitchHandle) { game = screenSwitchHandle; - this.waveSpawner = waveSpawner; } @Override @@ -46,7 +45,7 @@ private void addActors() { @Override public void changed(ChangeEvent changeEvent, Actor actor) { logger.debug("Pause button clicked"); - PauseMenuFactory.createPauseMenu(game, waveSpawner); + PauseMenuFactory.createPauseMenu(game); } }); diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java index 6503add30..285fad8e2 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java @@ -11,14 +11,7 @@ public class PauseMenuTimeStopComponent extends Component { private Array freezeList; - private Entity waveSpawner; - - /** - * Initialises the component. - * @param waveSpawner The entity that controls the wave spawning timer. - */ - public PauseMenuTimeStopComponent(Entity waveSpawner) { - this.waveSpawner = waveSpawner; + public PauseMenuTimeStopComponent() { } /** @@ -26,7 +19,6 @@ public PauseMenuTimeStopComponent(Entity waveSpawner) { */ @Override public void create() { - waveSpawner.getEvents().trigger("toggleWaveTimer"); freezeList = ServiceLocator.getEntityService().getEntities(); for (Entity pauseTarget : freezeList) { if (pauseTarget.getId() != getEntity().getId()) { @@ -41,7 +33,6 @@ public void create() { */ @Override public void dispose() { - waveSpawner.getEvents().trigger("toggleWaveTimer"); for (Entity pauseTarget : freezeList) { pauseTarget.setEnabled(true); } diff --git a/source/core/src/main/com/csse3200/game/components/tasks/SpawnWaveTask.java b/source/core/src/main/com/csse3200/game/components/tasks/SpawnWaveTask.java index 4150363aa..d6c4a3d85 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/SpawnWaveTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/SpawnWaveTask.java @@ -12,8 +12,6 @@ public class SpawnWaveTask extends DefaultTask implements PriorityTask { private final GameTime globalTime; private long endTime = 0; private final int SPAWNING_INTERVAL = 10; - private boolean wavesPaused = false; - private long pauseTime = 0; public SpawnWaveTask() { this.globalTime = ServiceLocator.getTimeSource(); } @@ -27,30 +25,13 @@ public int getPriority() { public void start() { super.start(); endTime = globalTime.getTime() + (SPAWNING_INTERVAL * 1000); - this.owner.getEntity().getEvents().addListener("toggleWaveTimer", this::toggleWaveTimer); } @Override public void update() { - if (!wavesPaused) { - if (globalTime.getTime() >= endTime) { - this.owner.getEntity().getEvents().trigger("spawnWave"); - endTime = globalTime.getTime() + (SPAWNING_INTERVAL * 1000L); // reset end time - } - } - } - - /** - * Function for pausing the wave timer when the pause menu is opened, and resuming it when the pause menu is closed. - */ - private void toggleWaveTimer() { - if (!wavesPaused) { - pauseTime = globalTime.getTime(); - wavesPaused = true; - } else { - // Offsets the next wave spawn by however long the game was paused. - endTime += globalTime.getTime() - pauseTime; - wavesPaused = false; + if (globalTime.getTime() >= endTime) { + this.owner.getEntity().getEvents().trigger("spawnWave"); + endTime = globalTime.getTime() + (SPAWNING_INTERVAL * 1000L); // reset end time } } } diff --git a/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java index bfd524ee7..fdb3a4204 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java @@ -12,13 +12,11 @@ public class PauseMenuFactory { /** * Creates the pause menu - * @param game The Gdx game instance that handles screen changes. - * @param waveSpawner The entity that handles the wave spawn timer * @return entity */ - public static Entity createPauseMenu(GdxGame game, Entity waveSpawner) { + public static Entity createPauseMenu(GdxGame game) { Entity pauseMenu = new Entity() - .addComponent(new PauseMenuTimeStopComponent(waveSpawner)) + .addComponent(new PauseMenuTimeStopComponent()) .addComponent(new PauseMenuRenderComponent()) .addComponent(new PauseMenuContinueButton()) .addComponent(new PauseMenuSettingsButton(game)) diff --git a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java index 77bdd47ea..a56755b6e 100644 --- a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java @@ -202,10 +202,7 @@ private void createUI() { .addComponent(new MainGameActions(this.game)) .addComponent(new MainGameExitDisplay()) .addComponent(new MainGameLoseDisplay()) - // WHERE'S THE WAVE SPAWNER, HOW IS THIS GAME FUNCTIONING WHEN IT DOESN'T EVEN MAKE A WAVE SPAWNER - // I'm told there's a new entity for the SpawnWaveTask, maybe it'll actually be accessible in this class. - // fyi there REALLY shouldn't be a null arg, but I need to push this before I can fix the issue. - .addComponent(new MainGamePauseDisplay(this.game, null)) + .addComponent(new MainGamePauseDisplay(this.game)) .addComponent(new Terminal()) .addComponent(inputComponent) .addComponent(new TerminalDisplay()); From 036037c45e6a2b2bdcca745fcabbea64032a3281 Mon Sep 17 00:00:00 2001 From: MajorDzaster Date: Fri, 29 Sep 2023 12:16:23 +1000 Subject: [PATCH 17/18] Added the background to the pause menu buttons. --- .../pausemenu/PauseMenuRenderComponent.java | 14 -------------- .../game/entities/factories/PauseMenuFactory.java | 7 +++++-- .../com/csse3200/game/screens/AssetLoader.java | 3 ++- 3 files changed, 7 insertions(+), 17 deletions(-) delete mode 100644 source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuRenderComponent.java diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuRenderComponent.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuRenderComponent.java deleted file mode 100644 index 078d13755..000000000 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuRenderComponent.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.csse3200.game.components.pausemenu; - -import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import com.csse3200.game.rendering.RenderComponent; - -/** - * Handles the rendering and de-rendering of the pause menu. - */ -public class PauseMenuRenderComponent extends RenderComponent { - @Override - public void draw(SpriteBatch batch) { - // TO DO: Actually make this function - } -} diff --git a/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java index fdb3a4204..71248198c 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java @@ -3,6 +3,7 @@ import com.csse3200.game.GdxGame; import com.csse3200.game.components.pausemenu.*; import com.csse3200.game.entities.Entity; +import com.csse3200.game.rendering.TextureRenderComponent; import com.csse3200.game.services.ServiceLocator; /** @@ -17,11 +18,13 @@ public class PauseMenuFactory { public static Entity createPauseMenu(GdxGame game) { Entity pauseMenu = new Entity() .addComponent(new PauseMenuTimeStopComponent()) - .addComponent(new PauseMenuRenderComponent()) .addComponent(new PauseMenuContinueButton()) .addComponent(new PauseMenuSettingsButton(game)) .addComponent(new PauseMenuPlanetSelectButton(game)) - .addComponent(new PauseMenuMainMenuButton(game)); + .addComponent(new PauseMenuMainMenuButton(game)) + .addComponent(new TextureRenderComponent("images/ui/Sprites/UI_Glass_Toggle_Bar_01a.png")); + pauseMenu.setScale(8, 8); + pauseMenu.setPosition(6.3f, 2f); ServiceLocator.getEntityService().register(pauseMenu); return pauseMenu; } diff --git a/source/core/src/main/com/csse3200/game/screens/AssetLoader.java b/source/core/src/main/com/csse3200/game/screens/AssetLoader.java index 6bb3c18a9..c0809ea82 100644 --- a/source/core/src/main/com/csse3200/game/screens/AssetLoader.java +++ b/source/core/src/main/com/csse3200/game/screens/AssetLoader.java @@ -70,7 +70,8 @@ public class AssetLoader { "images/projectiles/stun_effect.png", "images/projectiles/firework_anim.png", "images/projectiles/pierce_anim.png", - "images/projectiles/snow_ball.png" + "images/projectiles/snow_ball.png", + "images/ui/Sprites/UI_Glass_Toggle_Bar_01a.png" }; public static final String[] textureAtlases = { From fc2cd975e26d46e2370bc0dfbe7cc0194baff0ef Mon Sep 17 00:00:00 2001 From: MajorDzaster Date: Fri, 29 Sep 2023 12:47:06 +1000 Subject: [PATCH 18/18] Added a counter to PauseMenuFactory to prevent duplicate pause menus being made. --- .../maingame/MainGamePauseDisplay.java | 2 +- .../pausemenu/PauseMenuTimeStopComponent.java | 3 ++ .../entities/factories/PauseMenuFactory.java | 40 +++++++++++++------ 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java index eb8a0b273..9284f1492 100644 --- a/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/maingame/MainGamePauseDisplay.java @@ -45,7 +45,7 @@ private void addActors() { @Override public void changed(ChangeEvent changeEvent, Actor actor) { logger.debug("Pause button clicked"); - PauseMenuFactory.createPauseMenu(game); + PauseMenuFactory.createPauseMenu(game, false); } }); diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java index 285fad8e2..41aadee4c 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java @@ -3,6 +3,7 @@ import com.csse3200.game.components.Component; import com.csse3200.game.entities.Entity; import com.badlogic.gdx.utils.Array; +import com.csse3200.game.entities.factories.PauseMenuFactory; import com.csse3200.game.services.ServiceLocator; /** @@ -30,9 +31,11 @@ public void create() { /** * Handles the un-pausing of the game entities when the pause menu is closed. + * Also notifies the pause menu factory that the pause menu is being disposed. */ @Override public void dispose() { + PauseMenuFactory.decrementPauseMenuCount(); for (Entity pauseTarget : freezeList) { pauseTarget.setEnabled(true); } diff --git a/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java index 71248198c..a0dc1ad9d 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/PauseMenuFactory.java @@ -10,22 +10,36 @@ * Factory to create the pause menu and attach its components. */ public class PauseMenuFactory { + private static int pauseMenusActive = 0; /** * Creates the pause menu - * @return entity + * @param game The Gdx Game that handles screen changes + * @param duplicateOverride If false, will not create a pause menu if any currently exist + * @return entity, or null if no entity was created */ - public static Entity createPauseMenu(GdxGame game) { - Entity pauseMenu = new Entity() - .addComponent(new PauseMenuTimeStopComponent()) - .addComponent(new PauseMenuContinueButton()) - .addComponent(new PauseMenuSettingsButton(game)) - .addComponent(new PauseMenuPlanetSelectButton(game)) - .addComponent(new PauseMenuMainMenuButton(game)) - .addComponent(new TextureRenderComponent("images/ui/Sprites/UI_Glass_Toggle_Bar_01a.png")); - pauseMenu.setScale(8, 8); - pauseMenu.setPosition(6.3f, 2f); - ServiceLocator.getEntityService().register(pauseMenu); - return pauseMenu; + public static Entity createPauseMenu(GdxGame game, boolean duplicateOverride) { + if (pauseMenusActive == 0 || duplicateOverride) { + Entity pauseMenu = new Entity() + .addComponent(new PauseMenuTimeStopComponent()) + .addComponent(new PauseMenuContinueButton()) + .addComponent(new PauseMenuSettingsButton(game)) + .addComponent(new PauseMenuPlanetSelectButton(game)) + .addComponent(new PauseMenuMainMenuButton(game)) + .addComponent(new TextureRenderComponent("images/ui/Sprites/UI_Glass_Toggle_Bar_01a.png")); + pauseMenu.setScale(8, 8); + pauseMenu.setPosition(6.3f, 2f); + ServiceLocator.getEntityService().register(pauseMenu); + pauseMenusActive++; + return pauseMenu; + } + return null; + } + + /** + * Called when a pause menu is disposed to decrement the count of active pause menus. + */ + public static void decrementPauseMenuCount() { + pauseMenusActive--; } }