From c74637ae6ded59a2eb31518f9cc7739d4e3b8afd Mon Sep 17 00:00:00 2001 From: SushiTee Date: Sat, 15 Sep 2012 19:47:49 +0200 Subject: [PATCH] began to rewrite server browser and ingame menu --- data/browse_icons.png | Bin 3221 -> 0 bytes data/icons/browse.png | Bin 0 -> 4149 bytes data/icons/menu.png | Bin 0 -> 584 bytes data/icons/tools.png | Bin 0 -> 1625 bytes data/menu_buttons.png | Bin 919 -> 0 bytes data/menu_fold.png | Bin 1333 -> 0 bytes datasrc/content.py | 53 ++-- src/engine/client/serverbrowser.cpp | 2 +- src/game/client/components/chat.cpp | 5 + src/game/client/components/hud.cpp | 5 + src/game/client/components/menus.cpp | 93 ++++-- src/game/client/components/menus.h | 12 +- src/game/client/components/menus_browser.cpp | 304 +++++++++++++------ src/game/client/components/menus_demo.cpp | 29 +- src/game/client/components/menus_ingame.cpp | 105 +++---- src/game/variables.h | 2 +- 16 files changed, 388 insertions(+), 222 deletions(-) delete mode 100644 data/browse_icons.png create mode 100644 data/icons/browse.png create mode 100644 data/icons/menu.png create mode 100644 data/icons/tools.png delete mode 100644 data/menu_buttons.png delete mode 100644 data/menu_fold.png diff --git a/data/browse_icons.png b/data/browse_icons.png deleted file mode 100644 index 55ffb6bfd5e28c82cbeb5e5d843ee004a0be9cc9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3221 zcmY+HX*?8KAIHy3X6z9fWjEQ<5Scq9F*Db`(+H6*LK$1>62sU{(j`llWS8XH5-}69 zCMl9^k1ff_&Rk;1GoJgoFP<0Y{QuwI_q;f7&gYy%u{1Z}RPiZmNm#6 zaMnzX^t%B7kE4+;ju8BK`KpDNknM>GipeRj-!Um)K1YkHX8w?l@agY+lj~NKB!Q}z ze}>+_wJybGRaRhIVxyakeBFr%6w)dqwkF1>Nf2TbIS}4w*B^2`B)64UZI16;-(G&t zRQHpkrZ2He@~BOPUYJ^ClBPn{Ht)m*d^lM*An?og#mmzl4)U=6>AyAK*=?c-jW6@E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do2BqT2L$L@eys{%U&*l7Y>zSP>{kFVCEUw~*D6&9kM6p>`?wsq;q!6!% z%@jh|V@Uf%N>6zhx*qwJ1ABdpAe6nV#n5?KAR4`i#Q)CvZU7@abKOe3OVob>-k;`` diff --git a/data/icons/browse.png b/data/icons/browse.png new file mode 100644 index 0000000000000000000000000000000000000000..0b51aea955522530d640c956ac84528af5e48f4d GIT binary patch literal 4149 zcmV-55X$d~P)5Hf9Oh|q>qr5+IyVVdS|s&q;`T4HKVSE!D96av+T9L<>uaf_CELQ z@9gusKgr|qNI-oH^Q(scC!czCX%y0s6={e-G=|{c&+-sKTY@eG;RH`pgwuO%sgAJN z2*kq#eF*vyw5lhcN`YU0yGHI8@gs;Na2X(y>I#d6K>SRqA|CVkG`;6dpGxV*`R`)a zn2z`mv?B{#Z-ix&^yx^=4vz%}mS znN-yvv9yf01h!o(R;-u>P@mrPrxXy}6&f1)0zmz@cGw3pOD~DGy8?ZsDl#xZ<_%ZT z1A0p~vy|M}K0ZFr9yoAd#ofDiZ+SEX&!7Wc$$LSm?)^nYMJE8sVivF=Pr>KGg9rZz zQ2#w0v>zzZ!2A08#-*pHzqxz&?zEJYl*xgCfzL}d!3~kPOcW9lGGzVw^~pPS>{zmK z<3@My-o0Psbc3u^1Wb=bKrdao^iQq8D+Rig1hJCI;XpvDdq4A6&shNDzTDUq6&2S2 zTvPu}ylV$)%XR3`p^u3DVnrvree~$j3=o6qb?)4GaBgny<~w)pl<~Tim6bP-969od zR6~MbGZn#PP9F2ot9irMu3gJnw{G3MQKLqU25^mgybj7pHFE+}6GI)T)%%&Rdd>oJ z@8{cud)KFI+6KAgo}ZJGvtF;0;hjelNlZ-qRcUEyo}TXM)2F}WI;8M~8RLpP=JRR) zdW)MAw6)nVOzQN0CiRpBT1vFXk)C;#`NlQwQU9h^BnpwqwRi8{ z<$3{Sa{Kn}Qb0sEJ3IRWTE9M`mBGx`g~=T=f?iI84<m9gie)QPRZJ}YvQHrFRUTH^kdp{GK zS)hqj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IT}ck00000NkvXXu0mjfOjaaK literal 0 HcmV?d00001 diff --git a/data/icons/menu.png b/data/icons/menu.png new file mode 100644 index 0000000000000000000000000000000000000000..9445da6b494510dcf531c5f4b42d6bc0bd705705 GIT binary patch literal 584 zcmV-O0=NB%P)cc)=!_~T1eaKb- z8W(_};hDGHZnt|ckoz7obRJ|Ezm3t>(D2Oq`~Ci{K<<0UudZ)DmU zCTxvO()>m;{Q<L=s_3&0000LuVq1kLkJ}Feb`Nrhkl|M%w($8F*nsP`M zRyvTJd8`}!g`^9+3V{@ae_f?}D&63JY9{3XR5N@n0rv>23)k;oqToP^YvE@SV_199lTv2p9qzVuDLGk!1Ve zOYmo{Gz8;0V9KFZ4Ndo=^?*D~@D+Uf{xt7OE-M25ZC%*I!^3}&XbI_dXl9lc@O7<0 zKq<@w&YDOvCUC-steWrJn(d+qH$e`VpcB5nrtJ=PI10Of-xl^9$$}JX0`${Ot71Ao z&;)}uk^K8$9}U7co*nS7d*+KloD-;Jf?oK>XF~>&owDJ7aTGMx1n8p{Bj=t#x=avK z6Nma>ABDgV?ZO~mu)an~k`q3o2^Mqbh=7LH#FUvu=>1~gYYm#93iymBhzV>i7%9(~ zqFxgeg^%Ao0w8UIs|;VuX@a8g@psQagqpzX-fjNAFj8kIrQmDznxF`Lk_AxGfVN7* zhq4)4hj$n=1WEY4J!^_JtrUk2X7S!b`DO?u|VnCAk!B>M`=$+uQq#(&7;- zEZcG~1#kJ>cojBdBsZh9uyZy&J3ISqZ|P=$5A6tS2JQOZd=<81CAXuI&-70v6~A+{ z^-73Gs2T$@ZwGIOJODuH0COD3cuV}-usDQ*!zj;)_dv>zDou}$j{a?9c#f7pcLx+7 zj}YZM5YnR??M0y@c2k&HU~tK`{hCAAH=mxKo_>M}&=SzHrFlvD%97_uSZ$h>KbQCm zErIKVCK&_6jm*!23W%l~{kPX3t`!E6F!F1Pn{k!Vtd7H}Xx?AZd>V-EfNN|qs!y|e zPbZI()(C%%HNr2fl0hHgmsJz(C_wkA_K;OjK;%nRUljO(xs?PG$Q zwA_XtZg~<5`;_JzCMjFST`~**A~JsyMsV{h1RwwJYv``LhD>0?H}BgmCa1?j>XPmJ znEbn7NcO=#@E=fE8Gd%;<1&E@{UxIS;j@{b#z9!lL8z@&f}d=Hnx|norlDQ;tQkK0G_dxC80m#5 zTU$N%ssTRxLeMHK#Y!$koBF=v9<{-b`Rt%pVKYW@GfHcl7~x0kx#Zala;W%rtY`k% zihfEmi!QA2BMgvdJGe(U$jI?}c<_OY3iJbY!^hvF;71rB&w-HIRLQBN<{LVUgzn&B zXeJED?KWxodU)uOFqGjHts4AFj;8%Y^Vh>s6|A^nL#a XO9vIfwP-JX00000NkvXXu0mjfacdZ5 literal 0 HcmV?d00001 diff --git a/data/menu_buttons.png b/data/menu_buttons.png deleted file mode 100644 index 89225e36618eb303c3b948fa99ab2f870df7db22..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 919 zcmeAS@N?(olHy`uVBq!ia0vp^4M6O`!3HERU8}EWU|^2(ba4!+nDch7VczWkp0@uB zA~%V?m|)ml%;5hmsbR0%CGM1SGnTf$V62*|`!=qT~HRO8O8A9x^wN`J$wE{tiQhBeD>M-ck{j%YVce?u(iN9=61l@ zA9u75ZvSRIUuv(}ugHk?xw==bebfB#*Ldff`}gkE)z{bm-+KRj`O@|}u64cHPogHW zB``jonb0uX?X+9IhW(e|s_g7NhUM3lEkA5rc>C?Q{FjXVt=Y012OqQ6ZCH3-!~Vg> zs$;B*4~}b0dK4e}a$(fNS-)!)9t&`VsP0gpu3mt%3leXq# z=7kPGtx8+-v2sHNpw^|a`60QX055Z4@00C3cC6W2h#>Fb5ft-+-r1XK2ycxK{t zMZ7X`1D4?kk`@3CgM5SYM4O32E`{VrrEkzW^a#sgI z{|rBcjR8DOq!kU?x`93%}_^zX);~r!IxbAAWizz8> z)_m2|Add==GPY1C+*w>){LS0u%{4na`=hb3@it^3@cMtiQ7!pLl%HbK4v<~7XY+rkPriK z5mKg3OiX-b?`%$$%jGYS1>mZWk&X%h0Bss1gaBNCl&Pbmqo4R&n@_{T!yh0EK(mjD zj=}%{Wf~+z033moslC0u-AhYLe+2rwp=?ezH^>68*T+CdVF7?L4H5zXcEB>3rPUZ3 z8hS6$+5e#O-+ga2Cyodi_HnL0G#wS z%~2Ep1W$tm82~#4?9GnSYV`H>J=CxYYz{UT$Tq)qC1)?g97PF0&@@O80kGN!6+gFX zSOsg0{?baW-bOi!8i1f_P+41Gt3->za`WlM{xn*Jq^~X(X&=PtAJwkM*u*2 z8U#(bf3-$PfG44KhZfJe3aCeagaDL6YY#1+Z542g{>T960feuE7zVJc0*=ui5dijU zpx2GATmX2OK)MRJMt=kV;QtVWWCGbL;2izR0igLQ7|{rlRlqs=l>$I}GYHuX)K$Pe z`V|5|e>)i24761sG5Qq&!1q81fgvcXKw|VO0f6_BFd|ceR)N&$7Y0D)p->`IyjOwb z=obV)?y+z}W4u;@lC|u{lnwKzj5u1EAw*7_m83tDvi^t8;R4a;&oX^Yin+ zdU|^9gW%|A0zlW{PzHmlR)M|BM@B|I+N0g$~>M z39-B;PRKA6k((nZ>e|o&;5LlSAOUgJh7JIiVVnkWLcm=Y2>{fFNtna|fmmHJ875^? zP1h8QVbVs`YE4lXCT$XSP156U00000NkvXXu0mjfO#xp> diff --git a/datasrc/content.py b/datasrc/content.py index 80b4ea3e8..452368671 100644 --- a/datasrc/content.py +++ b/datasrc/content.py @@ -226,14 +226,14 @@ container.sounds.Add(SoundSet("menu", ["audio/music_menu.wv"])) image_null = Image("null", "") image_particles = Image("particles", "particles.png") image_game = Image("game", "game.png") -image_browseicons = Image("browseicons", "browse_icons.png") +image_browseicons = Image("browseicons", "icons/browse.png") image_emoticons = Image("emoticons", "emoticons.png") image_demobuttons = Image("demobuttons", "demo_buttons.png") image_fileicons = Image("fileicons", "file_icons.png") image_guibuttons = Image("guibuttons", "gui_buttons.png") image_guiicons = Image("guiicons", "gui_icons.png") -image_checkboxicons = Image("checkboxicons", "menu_buttons.png") -image_foldicons = Image("foldicons", "menu_fold.png") +image_menuicons = Image("menuicons", "icons/menu.png") +image_toolicons = Image("toolicons", "icons/tools.png") container.images.Add(image_null) container.images.Add(image_game) @@ -251,8 +251,8 @@ container.images.Add(image_guibuttons) container.images.Add(image_guiicons) container.images.Add(Image("no_skinpart", "no_skinpart.png")) container.images.Add(Image("hlpicker", "hlpicker.png")) -container.images.Add(image_checkboxicons) -container.images.Add(image_foldicons) +container.images.Add(image_menuicons) +container.images.Add(image_toolicons) container.pickups.Add(Pickup("health")) container.pickups.Add(Pickup("armor")) @@ -269,14 +269,14 @@ set_tee_decoration = SpriteSet("tee_decoration", image_null, 2, 1) set_tee_hands = SpriteSet("tee_hands", image_null, 2, 1) set_tee_feet = SpriteSet("tee_feet", image_null, 2, 1) set_tee_eyes = SpriteSet("tee_eyes", image_null, 2, 4) -set_browseicons = SpriteSet("browseicons", image_browseicons, 2, 4) +set_browseicons = SpriteSet("browseicons", image_browseicons, 4, 2) set_emoticons = SpriteSet("emoticons", image_emoticons, 4, 4) set_demobuttons = SpriteSet("demobuttons", image_demobuttons, 5, 1) set_fileicons = SpriteSet("fileicons", image_fileicons, 8, 1) set_guibuttons = SpriteSet("guibuttons", image_guibuttons, 12, 4) set_guiicons = SpriteSet("guiicons", image_guiicons, 8, 2) -set_checkboxicons = SpriteSet("checkboxicons", image_checkboxicons, 2, 1) -set_foldicons = SpriteSet("foldicons", image_foldicons, 2, 1) +set_menuicons = SpriteSet("menuicons", image_menuicons, 2, 2) +set_toolicons = SpriteSet("toolicons", image_toolicons, 4, 2) container.spritesets.Add(set_particles) container.spritesets.Add(set_game) @@ -292,8 +292,8 @@ container.spritesets.Add(set_demobuttons) container.spritesets.Add(set_fileicons) container.spritesets.Add(set_guibuttons) container.spritesets.Add(set_guiicons) -container.spritesets.Add(set_checkboxicons) -container.spritesets.Add(set_foldicons) +container.spritesets.Add(set_menuicons) +container.spritesets.Add(set_toolicons) container.sprites.Add(Sprite("part_slice", set_particles, 0,0,1,1)) container.sprites.Add(Sprite("part_ball", set_particles, 1,0,1,1)) @@ -413,13 +413,17 @@ container.sprites.Add(Sprite("eyes", set_emoticons, 2, 3, 1, 1)) container.sprites.Add(Sprite("question", set_emoticons, 3, 3, 1, 1)) container.sprites.Add(Sprite("browse_lock_a", set_browseicons, 0,0,1,1)) -container.sprites.Add(Sprite("browse_lock_b", set_browseicons, 1,0,1,1)) -container.sprites.Add(Sprite("browse_unpure_a", set_browseicons, 0,1,1,1)) +container.sprites.Add(Sprite("browse_lock_b", set_browseicons, 0,1,1,1)) +#container.sprites.Add(Sprite("browse_lock_c", set_browseicons, 2,0,1,1)) +container.sprites.Add(Sprite("browse_unpure_a", set_browseicons, 1,0,1,1)) container.sprites.Add(Sprite("browse_unpure_b", set_browseicons, 1,1,1,1)) -container.sprites.Add(Sprite("browse_star_a", set_browseicons, 0,2,1,1)) -container.sprites.Add(Sprite("browse_star_b", set_browseicons, 1,2,1,1)) -container.sprites.Add(Sprite("browse_info_a", set_browseicons, 0,3,1,1)) -container.sprites.Add(Sprite("browse_info_b", set_browseicons, 1,3,1,1)) +#container.sprites.Add(Sprite("browse_unpure_c", set_browseicons, 2,1,1,1)) +container.sprites.Add(Sprite("browse_star_a", set_browseicons, 2,0,1,1)) +container.sprites.Add(Sprite("browse_star_b", set_browseicons, 2,1,1,1)) +#container.sprites.Add(Sprite("browse_star_c", set_browseicons, 2,2,1,1)) +container.sprites.Add(Sprite("browse_heart_a", set_browseicons, 3,0,1,1)) +container.sprites.Add(Sprite("browse_heart_b", set_browseicons, 3,1,1,1)) +#container.sprites.Add(Sprite("browse_heart_c", set_browseicons, 2,3,1,1)) container.sprites.Add(Sprite("demobutton_play", set_demobuttons, 0,0,1,1)) container.sprites.Add(Sprite("demobutton_pause", set_demobuttons, 1,0,1,1)) @@ -440,11 +444,20 @@ container.sprites.Add(Sprite("guibutton_hover", set_guibuttons, 8,0,4,4)) container.sprites.Add(Sprite("guiicon_mute", set_guiicons, 0,0,4,2)) container.sprites.Add(Sprite("guiicon_friend", set_guiicons, 4,0,4,2)) -container.sprites.Add(Sprite("checkbox_active", set_checkboxicons, 0,0,1,1)) -container.sprites.Add(Sprite("checkbox_inactive", set_checkboxicons, 1,0,1,1)) +container.sprites.Add(Sprite("menu_checkbox_active", set_menuicons, 0,0,1,1)) +container.sprites.Add(Sprite("menu_checkbox_inactive", set_menuicons, 0,1,1,1)) +container.sprites.Add(Sprite("menu_collapsed", set_menuicons, 1,0,1,1)) +container.sprites.Add(Sprite("menu_expanded", set_menuicons, 1,1,1,1)) + +container.sprites.Add(Sprite("tool_up_a", set_toolicons, 0,0,1,1)) +container.sprites.Add(Sprite("tool_up_b", set_toolicons, 0,1,1,1)) +container.sprites.Add(Sprite("tool_down_a", set_toolicons, 1,0,1,1)) +container.sprites.Add(Sprite("tool_down_b", set_toolicons, 1,1,1,1)) +container.sprites.Add(Sprite("tool_edit_a", set_toolicons, 2,0,1,1)) +container.sprites.Add(Sprite("tool_edit_b", set_toolicons, 2,1,1,1)) +container.sprites.Add(Sprite("tool_x_a", set_toolicons, 3,0,1,1)) +container.sprites.Add(Sprite("tool_x_b", set_toolicons, 3,1,1,1)) -container.sprites.Add(Sprite("fold_expanded", set_foldicons, 0,0,1,1)) -container.sprites.Add(Sprite("fold_collapsed", set_foldicons, 1,0,1,1)) anim = Animation("base") anim.body.frames.Add(AnimKeyframe(0, 0, -4, 0)) diff --git a/src/engine/client/serverbrowser.cpp b/src/engine/client/serverbrowser.cpp index 152181cf3..4d9c7ef9e 100644 --- a/src/engine/client/serverbrowser.cpp +++ b/src/engine/client/serverbrowser.cpp @@ -143,7 +143,7 @@ bool CServerBrowser::CServerFilter::SortCompareMap(int Index1, int Index2) const CServerEntry *a = m_pServerBrowser->m_ppServerlist[Index1]; CServerEntry *b = m_pServerBrowser->m_ppServerlist[Index2]; int Result = str_comp_nocase(a->m_Info.m_aMap, b->m_Info.m_aMap); - return Result < 0 || (Result == 0 && (a->m_Info.m_Flags&FLAG_PURE)); + return Result < 0 || (Result == 0 && (a->m_Info.m_Flags&FLAG_PURE) && !(b->m_Info.m_Flags&FLAG_PURE)); } bool CServerBrowser::CServerFilter::SortComparePing(int Index1, int Index2) const diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index 376dcec0b..fe3ec8b71 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -16,6 +16,7 @@ #include #include +#include "menus.h" #include "chat.h" @@ -388,6 +389,10 @@ void CChat::OnRender() --m_PendingChatCounter; } + // dont render chat if the menu is active + if(m_pClient->m_pMenus->IsActive()) + return; + float Width = 300.0f*Graphics()->ScreenAspect(); Graphics()->MapScreen(0.0f, 0.0f, Width, 300.0f); float x = 5.0f; diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index 98d14cbaf..06640e1d7 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -11,6 +11,7 @@ #include #include +#include "menus.h" #include "controls.h" #include "camera.h" #include "hud.h" @@ -545,6 +546,10 @@ void CHud::OnRender() if(!m_pClient->m_Snap.m_pGameData) return; + // dont render hud if the menu is active + if(m_pClient->m_pMenus->IsActive()) + return; + m_Width = 300.0f*Graphics()->ScreenAspect(); m_Height = 300.0f; Graphics()->MapScreen(0.0f, 0.0f, m_Width, m_Height); diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 623ca6b77..3e582ce71 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -87,7 +87,7 @@ float *CMenus::ButtonFade(const void *pID, float Seconds, int Checked) return pFade; } -int CMenus::DoButton_Icon(int ImageId, int SpriteId, const CUIRect *pRect) +int CMenus::DoIcon(int ImageId, int SpriteId, const CUIRect *pRect) { Graphics()->TextureSet(g_pData->m_aImages[ImageId].m_Id); @@ -120,21 +120,29 @@ int CMenus::DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect, return Active ? UI()->DoButtonLogic(pID, "", Checked, pRect) : 0; } -int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners, float r, float FontFactor) +int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners, float r, float FontFactor, vec4 ColorHot, bool TextFade) { float Seconds = 0.6f; // 0.6 seconds for fade float *pFade = ButtonFade(pID, Seconds, Checked); float FadeVal = *pFade/Seconds; - RenderTools()->DrawUIRect(pRect, vec4(0.0f+FadeVal, 0.0f+FadeVal, 0.0f+FadeVal, 0.25f+FadeVal*0.5f), Corners, r); + vec4 Color = mix(vec4(0.0f, 0.0f, 0.0f, 0.25f), ColorHot, FadeVal); + + RenderTools()->DrawUIRect(pRect, Color, Corners, r); CUIRect Temp; pRect->HMargin(pRect->h>=20.0f?2.0f:1.0f, &Temp); Temp.HMargin((Temp.h*FontFactor)/2.0f, &Temp); - TextRender()->TextColor(1.0f-FadeVal, 1.0f-FadeVal, 1.0f-FadeVal, 1.0f); - TextRender()->TextOutlineColor(0.0f+FadeVal, 0.0f+FadeVal, 0.0f+FadeVal, 0.25f); + if(TextFade) + { + TextRender()->TextColor(1.0f-FadeVal, 1.0f-FadeVal, 1.0f-FadeVal, 1.0f); + TextRender()->TextOutlineColor(0.0f+FadeVal, 0.0f+FadeVal, 0.0f+FadeVal, 0.25f); + } UI()->DoLabel(&Temp, pText, Temp.h*ms_FontmodHeight, 0); - TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f); - TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.3f); + if(TextFade) + { + TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f); + TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.3f); + } return UI()->DoButtonLogic(pID, pText, Checked, pRect); } @@ -238,11 +246,23 @@ int CMenus::DoButton_GridHeader(const void *pID, const char *pText, int Checked, //void CMenus::ui_draw_grid_header(const void *id, const char *text, int checked, const CUIRect *r, const void *extra) { if(Checked) - RenderTools()->DrawUIRect(pRect, vec4(1,1,1,0.5f), 0, 0.0f); + { + RenderTools()->DrawUIRect(pRect, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 5.0f); + TextRender()->TextColor(0.0f, 0.0f, 0.0f, 1.0f); + TextRender()->TextOutlineColor(1.0f, 1.0f, 1.0f, 0.25f); + } + CUIRect Label; pRect->VSplitLeft(5.0f, 0, &Label); Label.y+=2.0f; - UI()->DoLabel(&Label, pText, pRect->h*ms_FontmodHeight*0.8f, -1); + UI()->DoLabel(&Label, pText, pRect->h*ms_FontmodHeight*0.8f, 0); + + if(Checked) + { + TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f); + TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.3f); + } + return UI()->DoButtonLogic(pID, pText, Checked, pRect); } @@ -281,13 +301,13 @@ int CMenus::DoButton_CheckBox_Common(const void *pID, const char *pText, const c t.VSplitLeft(5.0f, 0, &t); c.Margin(2.0f, &c); - Graphics()->TextureSet(g_pData->m_aImages[IMAGE_CHECKBOXICONS].m_Id); + Graphics()->TextureSet(g_pData->m_aImages[IMAGE_MENUICONS].m_Id); Graphics()->QuadsBegin(); Graphics()->SetColor(1.0f, 1.0f, 1.0f, UI()->HotItem() == pID ? 1.0f : 0.6f); if(Checked) - RenderTools()->SelectSprite(SPRITE_CHECKBOX_ACTIVE); + RenderTools()->SelectSprite(SPRITE_MENU_CHECKBOX_ACTIVE); else - RenderTools()->SelectSprite(SPRITE_CHECKBOX_INACTIVE); + RenderTools()->SelectSprite(SPRITE_MENU_CHECKBOX_INACTIVE); IGraphics::CQuadItem QuadItem(c.x, c.y, c.w, c.h); Graphics()->QuadsDrawTL(&QuadItem, 1); Graphics()->QuadsEnd(); @@ -310,6 +330,30 @@ int CMenus::DoButton_CheckBox_Number(const void *pID, const char *pText, int Che return DoButton_CheckBox_Common(pID, pText, aBuf, pRect); } +int CMenus::DoButton_SpriteID(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, int Corners, float r, bool Fade) +{ + float Seconds = 0.6f; // 0.6 seconds for fade + float *pFade = ButtonFade(pID, Seconds); + float FadeVal = *pFade/Seconds; + + CUIRect Icon = *pRect; + Icon.Margin(2.0f, &Icon); + + if(Fade) + RenderTools()->DrawUIRect(pRect, vec4(0.0f+FadeVal, 0.0f+FadeVal, 0.0f+FadeVal, 0.25f+FadeVal*0.5f), Corners, r); + else + RenderTools()->DrawUIRect(pRect, vec4(0.0f, 0.0f, 0.0f, 0.25f), Corners, r); + Graphics()->TextureSet(g_pData->m_aImages[ImageID].m_Id); + Graphics()->QuadsBegin(); + Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f); + RenderTools()->SelectSprite(SpriteID); + IGraphics::CQuadItem QuadItem(Icon.x, Icon.y, Icon.w, Icon.h); + Graphics()->QuadsDrawTL(&QuadItem, 1); + Graphics()->QuadsEnd(); + + return UI()->DoButtonLogic(pID, "", false, pRect); +} + int CMenus::DoButton_SpriteClean(int ImageID, int SpriteID, const CUIRect *pRect) { int Inside = UI()->MouseInside(pRect); @@ -562,13 +606,13 @@ float CMenus::DoDropdownMenu(void *pID, const CUIRect *pRect, const char *pStr, CUIRect Button; Header.VSplitLeft(Header.h, &Button, 0); Button.Margin(2.0f, &Button); - Graphics()->TextureSet(g_pData->m_aImages[IMAGE_FOLDICONS].m_Id); + Graphics()->TextureSet(g_pData->m_aImages[IMAGE_MENUICONS].m_Id); Graphics()->QuadsBegin(); Graphics()->SetColor(1.0f, 1.0f, 1.0f, UI()->HotItem() == pID ? 1.0f : 0.6f); if(Active) - RenderTools()->SelectSprite(SPRITE_FOLD_EXPANDED); + RenderTools()->SelectSprite(SPRITE_MENU_EXPANDED); else - RenderTools()->SelectSprite(SPRITE_FOLD_COLLAPSED); + RenderTools()->SelectSprite(SPRITE_MENU_COLLAPSED); IGraphics::CQuadItem QuadItem(Button.x, Button.y, Button.w, Button.h); Graphics()->QuadsDrawTL(&QuadItem, 1); Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f); @@ -765,12 +809,15 @@ void CMenus::UiDoListboxStart(const void *pID, float RowHeight, const char *pBot UI()->DoLabel(&Footer, pBottomText, Footer.h*ms_FontmodHeight*0.8f, 0); } - // list background - RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f); - // prepare the scroll View.VSplitRight(20.0f, &View, &Scroll); + // scroll background + RenderTools()->DrawUIRect(&Scroll, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f); + + // list background + RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f); + // setup the variables gs_ListBoxOriginalView = View; gs_ListBoxSelectedIndex = SelectedIndex; @@ -806,7 +853,6 @@ void CMenus::UiDoListboxStart(const void *pID, float RowHeight, const char *pBot // the list gs_ListBoxView = gs_ListBoxOriginalView; - gs_ListBoxView.VMargin(5.0f, &gs_ListBoxView); UI()->ClipEnable(&gs_ListBoxView); gs_ListBoxView.y -= gs_ListBoxScrollValue*Num*Row.h; } @@ -922,7 +968,6 @@ CMenus::CListboxItem CMenus::UiDoListboxNextItem(const void *pId, bool Selected) //selected_index = i; CUIRect r = Item.m_Rect; - r.Margin(1.5f, &r); RenderTools()->DrawUIRect(&r, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 5.0f); } @@ -1096,7 +1141,7 @@ void CMenus::RenderMenubar(CUIRect r) Left.VSplitLeft(ButtonWidth, &Button, &Left); static int s_InternetButton=0; - if(DoButton_MenuTabTop(&s_InternetButton, Localize("Internet"), m_ActivePage==PAGE_INTERNET, &Button)) + if(DoButton_MenuTabTop(&s_InternetButton, Localize("Global"), m_ActivePage==PAGE_INTERNET, &Button)) { m_pClient->m_pCamera->ChangePosition(CCamera::POS_INTERNET); ServerBrowser()->Refresh(IServerBrowser::TYPE_INTERNET); @@ -1107,7 +1152,7 @@ void CMenus::RenderMenubar(CUIRect r) Left.VSplitLeft(Spacing, 0, &Left); // little space Left.VSplitLeft(ButtonWidth, &Button, &Left); static int s_LanButton=0; - if(DoButton_MenuTabTop(&s_LanButton, Localize("LAN"), m_ActivePage==PAGE_LAN, &Button)) + if(DoButton_MenuTabTop(&s_LanButton, Localize("Local"), m_ActivePage==PAGE_LAN, &Button)) { m_pClient->m_pCamera->ChangePosition(CCamera::POS_LAN); ServerBrowser()->Refresh(IServerBrowser::TYPE_LAN); @@ -1756,9 +1801,7 @@ int CMenus::Render() Box.HSplitTop(12.0f, 0, &Part); UI()->DoLabel(&Part, pExtraText, ButtonHeight*ms_FontmodHeight*0.8f, ExtraAlign); Part.HSplitTop(12.0f, 0, &Part); - UI()->DoLabel(&Part, Localize("There's an unsaved map in the editor,"), ButtonHeight*ms_FontmodHeight*0.8f, ExtraAlign); - Part.HSplitTop(12.0f, 0, &Part); - UI()->DoLabel(&Part, Localize("you might want to save it before you quit the game."), ButtonHeight*ms_FontmodHeight*0.8f, ExtraAlign); + UI()->DoLabel(&Part, Localize("There's an unsaved map in the editor, you might want to save it before you quit the game."), ButtonHeight*ms_FontmodHeight*0.8f, ExtraAlign); } else { diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index 33ebb0375..4aead6357 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -35,11 +35,11 @@ class CMenus : public CComponent int DoButton_DemoPlayer(const void *pID, const char *pText, const CUIRect *pRect); - int DoButton_Sprite(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, int Corners); + int DoButton_SpriteID(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, int Corners=CUI::CORNER_ALL, float r=5.0f, bool Fade=true); int DoButton_SpriteClean(int ImageID, int SpriteID, const CUIRect *pRect); int DoButton_SpriteCleanID(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect); int DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect, bool Active); - int DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners=CUI::CORNER_ALL, float r=5.0f, float FontFactor=0.0f); + int DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners=CUI::CORNER_ALL, float r=5.0f, float FontFactor=0.0f, vec4 ColorHot=vec4(1.0f, 1.0f, 1.0f, 0.75f), bool TextFade=true); int DoButton_MenuImage(const void *pID, const char *pText, int Checked, const CUIRect *pRect, const char *pImageName, float r=5.0f, float FontFactor=0.0f); int DoButton_MenuTab(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners); int DoButton_MenuTabTop(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners=CUI::CORNER_ALL, float r=5.0f, float FontFactor=0.0f); @@ -57,7 +57,7 @@ class CMenus : public CComponent static void ui_draw_settings_tab_button(const void *id, const char *text, int checked, const CUIRect *r, const void *extra); */ - int DoButton_Icon(int ImageId, int SpriteId, const CUIRect *pRect); + int DoIcon(int ImageId, int SpriteId, const CUIRect *pRect); int DoButton_GridHeader(const void *pID, const char *pText, int Checked, const CUIRect *pRect); int DoButton_GridHeaderIcon(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, int Corners); @@ -355,8 +355,8 @@ class CMenus : public CComponent COL_MAP, COL_PLAYERS, COL_PING, - COL_FAVORITE, - COL_INFO, + //COL_FAVORITE, + //COL_INFO, NUM_COLS, }; @@ -429,7 +429,7 @@ class CMenus : public CComponent void RenderServerbrowserBottomBox(CUIRect View); void RenderServerbrowserOverlay(); bool RenderFilterHeader(CUIRect View, int FilterIndex); - int DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *pEntry); + int DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *pEntry, bool Selected); void RenderServerbrowser(CUIRect MainView); static void ConchainFriendlistUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData); static void ConchainServerbrowserUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData); diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index b344d5898..a80b9b29d 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -19,14 +19,14 @@ #include "menus.h" CMenus::CColumn CMenus::ms_aCols[] = { - {COL_FLAG, -1, " ", -1, 80.0f, 0, {0}, {0}}, // Localize - these strings are localized within CLocConstString + {COL_FLAG, -1, " ", -1, 87.0f, 0, {0}, {0}}, // Localize - these strings are localized within CLocConstString {COL_NAME, IServerBrowser::SORT_NAME, "Name", 0, 300.0f, 0, {0}, {0}}, - {COL_GAMETYPE, IServerBrowser::SORT_GAMETYPE, "Type", 1, 50.0f, 0, {0}, {0}}, + {COL_GAMETYPE, IServerBrowser::SORT_GAMETYPE, "Type", 1, 70.0f, 0, {0}, {0}}, {COL_MAP, IServerBrowser::SORT_MAP, "Map", 1, 100.0f, 0, {0}, {0}}, {COL_PLAYERS, IServerBrowser::SORT_NUMPLAYERS, "Players", 1, 60.0f, 0, {0}, {0}}, {COL_PING, IServerBrowser::SORT_PING, "Ping", 1, 40.0f, 0, {0}, {0}}, - {COL_FAVORITE, -1, " ", 1, 14.0f, 0, {0}, {0}}, - {COL_INFO, -1, " ", 1, 14.0f, 0, {0}, {0}}, + //{COL_FAVORITE, -1, " ", 1, 14.0f, 0, {0}, {0}}, + //{COL_INFO, -1, " ", 1, 14.0f, 0, {0}, {0}}, }; @@ -149,7 +149,7 @@ void CMenus::SetOverlay(int Type, float x, float y, const void *pData) m_InfoOverlay.m_pData = pData; } -int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *pEntry) +int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *pEntry, bool Selected) { // logic int ReturnValue = 0; @@ -170,8 +170,7 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p UI()->SetActiveItem(pID); CUIRect r = *pRect; - r.Margin(1.5f, &r); - RenderTools()->DrawUIRect(&r, vec4(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 4.0f); + RenderTools()->DrawUIRect(&r, vec4(1.0f, 1.0f, 1.0f, 0.5f), CUI::CORNER_ALL, 4.0f); } if(Inside) @@ -200,6 +199,13 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p } } + vec3 TextBaseColor = vec3(1.0f, 1.0f, 1.0f); + if(Selected || Inside) + { + TextBaseColor = vec3(0.0f, 0.0f, 0.0f); + TextRender()->TextOutlineColor(1.0f, 1.0f, 1.0f, 0.25f); + } + float TextAplpha = (pEntry->m_NumPlayers == pEntry->m_MaxPlayers || pEntry->m_NumClients == pEntry->m_MaxClients) ? 0.5f : 1.0f; for(int c = 0; c < NUM_COLS; c++) { @@ -217,29 +223,51 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p CUIRect Rect = Button; CUIRect Icon; - Rect.HMargin(1.0f, &Rect); Rect.VSplitLeft(2.0f, 0, &Rect); Rect.VSplitLeft(Rect.h, &Icon, &Rect); if(pEntry->m_Flags&IServerBrowser::FLAG_PASSWORD) - DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_LOCK_A, &Icon); + { + Icon.Margin(2.0f, &Icon); + DoIcon(IMAGE_BROWSEICONS, Selected ? SPRITE_BROWSE_LOCK_B : SPRITE_BROWSE_LOCK_A, &Icon); + } Rect.VSplitLeft(2.0f, 0, &Rect); Rect.VSplitLeft(Rect.h, &Icon, &Rect); if(!(pEntry->m_Flags&IServerBrowser::FLAG_PURE)) - DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_UNPURE_A, &Icon); + { + Icon.Margin(2.0f, &Icon); + DoIcon(IMAGE_BROWSEICONS, Selected ? SPRITE_BROWSE_UNPURE_B : SPRITE_BROWSE_UNPURE_A, &Icon); + } Rect.VSplitLeft(2.0f, 0, &Rect); Rect.VSplitLeft(Rect.h, &Icon, &Rect); if(pEntry->m_Favorite) - DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_A, &Icon); + { + Icon.Margin(2.0f, &Icon); + DoIcon(IMAGE_BROWSEICONS, Selected ? SPRITE_BROWSE_STAR_B : SPRITE_BROWSE_STAR_A, &Icon); + } + + Rect.VSplitLeft(2.0f, 0, &Rect); + Rect.VSplitLeft(Rect.h, &Icon, &Rect); + if(pEntry->m_FriendState != IFriends::FRIEND_NO) + { + Icon.Margin(2.0f, &Icon); + DoIcon(IMAGE_BROWSEICONS, Selected ? SPRITE_BROWSE_HEART_B : SPRITE_BROWSE_HEART_A, &Icon); + } } else if(ID == COL_NAME) { CTextCursor Cursor; - TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); - Cursor.m_LineWidth = Button.w; - - TextRender()->TextColor(1.0f, 1.0f, 1.0f, TextAplpha); + float tw = TextRender()->TextWidth(0, 12.0f, pEntry->m_aName, -1); + if(tw < Button.w) + TextRender()->SetCursor(&Cursor, Button.x+Button.w/2.0f-tw/2.0f, Button.y, 12.0f, TEXTFLAG_RENDER); + else + { + TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); + Cursor.m_LineWidth = Button.w; + } + + TextRender()->TextColor(TextBaseColor.r, TextBaseColor.g, TextBaseColor.b, TextAplpha); if(g_Config.m_BrFilterString[0] && (pEntry->m_QuickSearchHit&IServerBrowser::QUICK_SERVERNAME)) { @@ -250,7 +278,7 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p TextRender()->TextEx(&Cursor, pEntry->m_aName, (int)(pStr-pEntry->m_aName)); TextRender()->TextColor(0.4f, 0.4f, 1.0f, TextAplpha); TextRender()->TextEx(&Cursor, pStr, str_length(g_Config.m_BrFilterString)); - TextRender()->TextColor(1.0f, 1.0f, 1.0f, TextAplpha); + TextRender()->TextColor(TextBaseColor.r, TextBaseColor.g, TextBaseColor.b, TextAplpha); TextRender()->TextEx(&Cursor, pStr+str_length(g_Config.m_BrFilterString), -1); } else @@ -262,10 +290,16 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p else if(ID == COL_MAP) { CTextCursor Cursor; - TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f * UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); - Cursor.m_LineWidth = Button.w; + float tw = TextRender()->TextWidth(0, 12.0f, pEntry->m_aMap, -1); + if(tw < Button.w) + TextRender()->SetCursor(&Cursor, Button.x+Button.w/2.0f-tw/2.0f, Button.y, 12.0f, TEXTFLAG_RENDER); + else + { + TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); + Cursor.m_LineWidth = Button.w; + } - TextRender()->TextColor(1.0f, 1.0f, 1.0f, TextAplpha); + TextRender()->TextColor(TextBaseColor.r, TextBaseColor.g, TextBaseColor.b, TextAplpha); if(g_Config.m_BrFilterString[0] && (pEntry->m_QuickSearchHit&IServerBrowser::QUICK_MAPNAME)) { @@ -276,7 +310,7 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p TextRender()->TextEx(&Cursor, pEntry->m_aMap, (int)(pStr-pEntry->m_aMap)); TextRender()->TextColor(0.4f, 0.4f, 1.0f, TextAplpha); TextRender()->TextEx(&Cursor, pStr, str_length(g_Config.m_BrFilterString)); - TextRender()->TextColor(1.0f, 1.0f, 1.0f, TextAplpha); + TextRender()->TextColor(TextBaseColor.r, TextBaseColor.g, TextBaseColor.b, TextAplpha); TextRender()->TextEx(&Cursor, pStr+str_length(g_Config.m_BrFilterString), -1); } else @@ -287,7 +321,7 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p } else if(ID == COL_PLAYERS) { - TextRender()->TextColor(1.0f, 1.0f, 1.0f, TextAplpha); + TextRender()->TextColor(TextBaseColor.r, TextBaseColor.g, TextBaseColor.b, TextAplpha); if(g_Config.m_BrFilterSpectators) str_format(aTemp, sizeof(aTemp), "%d/%d", pEntry->m_NumPlayers, pEntry->m_MaxPlayers); @@ -295,7 +329,8 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p str_format(aTemp, sizeof(aTemp), "%d/%d", pEntry->m_NumClients, pEntry->m_MaxClients); if(g_Config.m_BrFilterString[0] && (pEntry->m_QuickSearchHit&IServerBrowser::QUICK_PLAYER)) TextRender()->TextColor(0.4f, 0.4f, 1.0f, TextAplpha); - UI()->DoLabelScaled(&Button, aTemp, 12.0f, 1); + Button.y += 2.0f; + UI()->DoLabel(&Button, aTemp, 12.0f, 0); } else if(ID == COL_PING) { @@ -321,17 +356,25 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p vec4 Color = mix(StartColor, EndColor, MixVal); str_format(aTemp, sizeof(aTemp), "%d", pEntry->m_Latency); TextRender()->TextColor(Color.r, Color.g, Color.b, Color.a); - UI()->DoLabelScaled(&Button, aTemp, 12.0f, 1); + Button.y += 2.0f; + UI()->DoLabel(&Button, aTemp, 12.0f, 0); } else if(ID == COL_GAMETYPE) { CTextCursor Cursor; - TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f*UI()->Scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); - Cursor.m_LineWidth = Button.w; - TextRender()->TextColor(1.0f, 1.0f, 1.0f, TextAplpha); + float tw = TextRender()->TextWidth(0, 12.0f, pEntry->m_aGameType, -1); + if(tw < Button.w) + TextRender()->SetCursor(&Cursor, Button.x+Button.w/2.0f-tw/2.0f, Button.y, 12.0f, TEXTFLAG_RENDER); + else + { + TextRender()->SetCursor(&Cursor, Button.x, Button.y, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); + Cursor.m_LineWidth = Button.w; + } + + TextRender()->TextColor(TextBaseColor.r, TextBaseColor.g, TextBaseColor.b, TextAplpha); TextRender()->TextEx(&Cursor, pEntry->m_aGameType, -1); } - else if(ID == COL_FAVORITE) + /*else if(ID == COL_FAVORITE) { Button.HMargin(1.5f, &Button); if(DoButton_SpriteClean(IMAGE_BROWSEICONS, pEntry->m_Favorite ? SPRITE_BROWSE_STAR_A : SPRITE_BROWSE_STAR_B, &Button)) @@ -345,11 +388,12 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p else if(ID == COL_INFO) { Button.HMargin(1.5f, &Button); - if(DoButton_MouseOver(IMAGE_BROWSEICONS, SPRITE_BROWSE_INFO_A, &Button)) + if(DoButton_MouseOver(IMAGE_BROWSEICONS, SPRITE_BROWSE_HEART_A, &Button)) SetOverlay(CInfoOverlay::OVERLAY_SERVERINFO, Button.x, Button.y, pEntry); - } + }*/ } + TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.3f); TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f); return ReturnValue; @@ -359,20 +403,26 @@ bool CMenus::RenderFilterHeader(CUIRect View, int FilterIndex) { CBrowserFilter *pFilter = &m_lFilters[FilterIndex]; + float ButtonHeight = 20.0f; + float Spacing = 3.0f; + RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f); - CUIRect Button, Label; - View.HMargin(1.0f, &View); - - View.VSplitLeft(20.0f, 0, &Button); - Button.VSplitLeft(18.0f, &Button, 0); - if(DoButton_SpriteClean(IMAGE_FOLDICONS, pFilter->Extended() ? SPRITE_FOLD_EXPANDED : SPRITE_FOLD_COLLAPSED, &Button)) + CUIRect Button, EditButtons; + View.VSplitLeft(20.0f, &Button, &View); + Button.Margin(2.0f, &Button); + if(DoButton_SpriteClean(IMAGE_MENUICONS, pFilter->Extended() ? SPRITE_MENU_EXPANDED : SPRITE_MENU_COLLAPSED, &Button)) pFilter->Switch(); - View.VSplitLeft(50.0f, 0, &Label); - Label.HMargin(2.0f, &Label); - if(pFilter->Custom() <= CBrowserFilter::FILTER_ALL) - UI()->DoLabel(&Label, pFilter->Name(), 12.0f, -1); + // split buttons from label + View.VSplitLeft(Spacing, 0, &View); + View.VSplitRight((ButtonHeight+Spacing)*4.0f, &View, &EditButtons); + + View.y += 2.0f; + UI()->DoLabel(&View, pFilter->Name(), ButtonHeight*ms_FontmodHeight*0.8f, 0); + + /*if(pFilter->Custom() <= CBrowserFilter::FILTER_ALL) + UI()->DoLabel(&View, pFilter->Name(), 12.0f, -1); else { Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BROWSEICONS].m_Id); @@ -387,42 +437,66 @@ bool CMenus::RenderFilterHeader(CUIRect View, int FilterIndex) Label.VSplitLeft(25.0f, 0, &Label); UI()->DoLabel(&Label, pFilter->Name(), 12.0f, -1); - } + }*/ - View.VSplitRight(20.0f, &Button, 0); - Button.VSplitRight(18.0f, &View, &Button); + EditButtons.VSplitRight(ButtonHeight, &EditButtons, &Button); + Button.Margin(2.0f, &Button); if(pFilter->Custom() == CBrowserFilter::FILTER_CUSTOM) { - if(DoButton_SpriteClean(IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_A, &Button)) + if(DoButton_SpriteClean(IMAGE_TOOLICONS, SPRITE_TOOL_X_A, &Button)) { RemoveFilter(FilterIndex); return true; } } + else + DoIcon(IMAGE_TOOLICONS, SPRITE_TOOL_X_B, &Button); - View.VSplitRight(2.0f, &Button, 0); - Button.VSplitRight(18.0f, &View, &Button); - if(DoButton_MouseOver(IMAGE_BROWSEICONS, SPRITE_BROWSE_INFO_A, &Button)) - SetOverlay(CInfoOverlay::OVERLAY_HEADERINFO, Button.x, Button.y, pFilter); + EditButtons.VSplitRight(Spacing, &EditButtons, 0); + EditButtons.VSplitRight(ButtonHeight, &EditButtons, &Button); + Button.Margin(2.0f, &Button); + if(pFilter->Custom() == CBrowserFilter::FILTER_CUSTOM) + { + if(DoButton_SpriteClean(IMAGE_TOOLICONS, SPRITE_TOOL_EDIT_A, &Button)) + { + RemoveFilter(FilterIndex); + return true; + } + } + else + DoIcon(IMAGE_TOOLICONS, SPRITE_TOOL_EDIT_B, &Button); - View.VSplitRight(2.0f, &Button, 0); + /*EditButtons.VSplitRight(Spacing, &EditButtons, 0): + EditButtons.VSplitRight(ButtonHeight, &EditButtons, &Button); Button.VSplitRight(18.0f, &View, &Button); if(DoButton_SpriteCleanID(pFilter, IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_A, &Button)) // TODO: using the address of filter as ID is prolly a bad idea { static int s_EditPopupID = 0; m_SelectedFilter = FilterIndex; InvokePopupMenu(&s_EditPopupID, 0, UI()->MouseX(), UI()->MouseY(), 200.0f, 310.0f, PopupFilter); + }*/ + + EditButtons.VSplitRight(Spacing, &EditButtons, 0); + EditButtons.VSplitRight(ButtonHeight, &EditButtons, &Button); + Button.Margin(2.0f, &Button); + if(FilterIndex < m_lFilters.size()-1) + { + if(DoButton_SpriteClean(IMAGE_TOOLICONS, SPRITE_TOOL_UP_A, &Button)) + Move(false, FilterIndex); } + else + DoIcon(IMAGE_TOOLICONS, SPRITE_TOOL_UP_B, &Button); - View.VSplitRight(2.0f, &Button, 0); - Button.VSplitRight(18.0f, &View, &Button); - if(DoButton_SpriteClean(IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_A, &Button)) - Move(true, FilterIndex); - - View.VSplitRight(2.0f, &Button, 0); - Button.VSplitRight(18.0f, &View, &Button); - if(DoButton_SpriteClean(IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_B, &Button)) - Move(false, FilterIndex); + EditButtons.VSplitRight(Spacing, &EditButtons, 0); + EditButtons.VSplitRight(ButtonHeight, &EditButtons, &Button); + Button.Margin(2.0f, &Button); + if(FilterIndex > 0) + { + if(DoButton_SpriteClean(IMAGE_TOOLICONS, SPRITE_TOOL_DOWN_A, &Button)) + Move(true, FilterIndex); + } + else + DoIcon(IMAGE_TOOLICONS, SPRITE_TOOL_DOWN_B, &Button); return false; } @@ -478,11 +552,14 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) CUIRect Headers; CUIRect Status; + float SpacingH = 2.0f; + float ButtonHeight = 20.0f; + // background RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f); View.HSplitTop(ms_ListheaderHeight, &Headers, &View); - View.HSplitBottom(28.0f, &View, &Status); + View.HSplitBottom(ButtonHeight*3.0f+SpacingH*2.0f, &View, &Status); Headers.VSplitRight(20.0f, &Headers, 0); @@ -524,18 +601,25 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) CUIRect Rect = ms_aCols[i].m_Rect; CUIRect Icon; - Rect.HMargin(1.0f, &Rect); Rect.VSplitLeft(2.0f, 0, &Rect); Rect.VSplitLeft(Rect.h, &Icon, &Rect); - DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_LOCK_A, &Icon); + Icon.Margin(2.0f, &Icon); + DoIcon(IMAGE_BROWSEICONS, SPRITE_BROWSE_LOCK_A, &Icon); Rect.VSplitLeft(2.0f, 0, &Rect); Rect.VSplitLeft(Rect.h, &Icon, &Rect); - DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_UNPURE_A, &Icon); + Icon.Margin(2.0f, &Icon); + DoIcon(IMAGE_BROWSEICONS, SPRITE_BROWSE_UNPURE_A, &Icon); Rect.VSplitLeft(2.0f, 0, &Rect); Rect.VSplitLeft(Rect.h, &Icon, &Rect); - DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_A, &Icon); + Icon.Margin(2.0f, &Icon); + DoIcon(IMAGE_BROWSEICONS, SPRITE_BROWSE_STAR_A, &Icon); + + Rect.VSplitLeft(2.0f, 0, &Rect); + Rect.VSplitLeft(Rect.h, &Icon, &Rect); + Icon.Margin(2.0f, &Icon); + DoIcon(IMAGE_BROWSEICONS, SPRITE_BROWSE_HEART_A, &Icon); } else if(DoButton_GridHeader(ms_aCols[i].m_Caption, ms_aCols[i].m_Caption, g_Config.m_BrSort == ms_aCols[i].m_Sort, &ms_aCols[i].m_Rect)) { @@ -550,11 +634,39 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) } } - RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f); - + // split scrollbar from view CUIRect Scroll; View.VSplitRight(20.0f, &View, &Scroll); + // scrollbar background + RenderTools()->DrawUIRect(&Scroll, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f); + + // list background + RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f); + { + int Column = COL_PING; + switch(g_Config.m_BrSort) + { + case IServerBrowser::SORT_NAME: + Column = COL_NAME; + break; + case IServerBrowser::SORT_GAMETYPE: + Column = COL_GAMETYPE; + break; + case IServerBrowser::SORT_MAP: + Column = COL_MAP; + break; + case IServerBrowser::SORT_NUMPLAYERS: + Column = COL_PLAYERS; + break; + } + + CUIRect Rect = View; + Rect.x = CMenus::ms_aCols[Column].m_Rect.x; + Rect.w = CMenus::ms_aCols[Column].m_Rect.w; + RenderTools()->DrawUIRect(&Rect, vec4(0.0f, 0.0f, 0.0f, 0.05f), CUI::CORNER_ALL, 5.0f); + } + // display important messages in the middle of the screen so no // users misses it { @@ -748,8 +860,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) if(m_SelectedServer.m_Filter == s && m_SelectedServer.m_Index == i) { CUIRect r = Row; - r.Margin(1.5f, &r); - RenderTools()->DrawUIRect(&r, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 4.0f); + RenderTools()->DrawUIRect(&r, vec4(1.0f, 1.0f, 1.0f, 0.5f), CUI::CORNER_ALL, 4.0f); } } else @@ -762,7 +873,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) continue; } - if(DoBrowserEntry(pFilter->ID(ItemIndex), &Row, pItem)) + if(DoBrowserEntry(pFilter->ID(ItemIndex), &Row, pItem, m_SelectedServer.m_Filter == s && m_SelectedServer.m_Index == i)) { m_SelectedServer.m_Filter = s; m_SelectedServer.m_Index = i; @@ -780,28 +891,29 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) UI()->ClipDisable(); - Status.Margin(5.0f, &Status); + // bottom + float SpacingW = 3.0f; + float ButtonWidth = (Status.w/6.0f)-(SpacingW*5.0)/6.0f; - // render quick search - CUIRect QuickSearch, Button; - Status.VSplitLeft(240.0f, &QuickSearch, &Status); - const char *pLabel = Localize("Quick search:"); - UI()->DoLabelScaled(&QuickSearch, pLabel, 12.0f, -1); - float w = TextRender()->TextWidth(0, 12.0f, pLabel, -1); - QuickSearch.VSplitLeft(w, 0, &QuickSearch); - QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch); - QuickSearch.VSplitLeft(240.0f-w-22.0f, &QuickSearch, &Button); - static float Offset = 0.0f; - if(DoEditBox(&g_Config.m_BrFilterString, &QuickSearch, g_Config.m_BrFilterString, sizeof(g_Config.m_BrFilterString), 12.0f, &Offset, false, CUI::CORNER_L)) + // cut view + CUIRect Left, Label, EditBox, Button; + Status.VSplitLeft(ButtonWidth*3.0f+SpacingH*2.0f, &Left, &Status); + + // render quick search and host address + Left.HSplitTop(((ButtonHeight*3.0f+SpacingH*2.0f)-(ButtonHeight*2.0f+SpacingH))/2.0f, 0, &Left); + Left.HSplitTop(ButtonHeight, &Label, &Left); + Label.VSplitRight(ButtonWidth*2.0f+SpacingH, &Label, &EditBox); + Label.y += 2.0f; + UI()->DoLabel(&Label, Localize("Search:"), ButtonHeight*ms_FontmodHeight*0.8f, 0); + EditBox.VSplitRight(EditBox.h, &EditBox, &Button); + static float s_ClearOffset = 0.0f; + if(DoEditBox(&g_Config.m_BrFilterString, &EditBox, g_Config.m_BrFilterString, sizeof(g_Config.m_BrFilterString), ButtonHeight*ms_FontmodHeight*0.8f, &s_ClearOffset, false, CUI::CORNER_ALL)) Client()->ServerBrowserUpdate(); // clear button { static int s_ClearButton = 0; - float *pClearButtonFade = ButtonFade(&s_ClearButton, 0.6f); - RenderTools()->DrawUIRect(&Button, vec4(1.0f, 1.0f, 1.0f, 0.33f+(*pClearButtonFade/0.6f)*0.165f), CUI::CORNER_R, 3.0f); - UI()->DoLabel(&Button, "x", Button.h*ms_FontmodHeight, 0); - if(UI()->DoButtonLogic(&s_ClearButton, "x", 0, &Button)) + if(DoButton_SpriteID(&s_ClearButton, IMAGE_TOOLICONS, SPRITE_TOOL_X_A, &Button, CUI::CORNER_ALL, 5.0f, false)) { g_Config.m_BrFilterString[0] = 0; UI()->SetActiveItem(&g_Config.m_BrFilterString); @@ -809,14 +921,24 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) } } + Left.HSplitTop(SpacingH, 0, &Left); + Left.HSplitTop(ButtonHeight, &Label, 0); + Label.VSplitRight(ButtonWidth*2.0f+SpacingH, &Label, &EditBox); + Label.y += 2.0f; + UI()->DoLabel(&Label, Localize("Host address:"), ButtonHeight*ms_FontmodHeight*0.8f, 0); + static float s_AddressOffset = 0.0f; + DoEditBox(&g_Config.m_UiServerAddress, &EditBox, g_Config.m_UiServerAddress, sizeof(g_Config.m_UiServerAddress), ButtonHeight*ms_FontmodHeight*0.8f, &s_AddressOffset, false, CUI::CORNER_ALL); + // render status + Status.HSplitTop(ButtonHeight+SpacingH, 0, &Status); + Status.HSplitTop(ButtonHeight, &Status, 0); char aBuf[128]; if(ServerBrowser()->IsRefreshing()) str_format(aBuf, sizeof(aBuf), Localize("%d%% loaded"), ServerBrowser()->LoadingProgression()); else str_format(aBuf, sizeof(aBuf), Localize("%d servers, %d players"), ServerBrowser()->NumServers(), NumPlayers); - Status.VSplitRight(TextRender()->TextWidth(0, 14.0f, aBuf, -1), 0, &Status); - UI()->DoLabelScaled(&Status, aBuf, 14.0f, -1); + Status.y += 2.0f; + UI()->DoLabel(&Status, aBuf, 14.0f, 0); } void CMenus::RenderServerbrowserFilters(CUIRect View) @@ -1286,19 +1408,11 @@ void CMenus::RenderServerbrowserBottomBox(CUIRect MainView) MainView.VSplitLeft(Spacing, 0, &MainView); // little space MainView.VSplitLeft(ButtonWidth, &Button, &MainView); static int s_JoinButton = 0; - if(DoButton_Menu(&s_JoinButton, Localize("Join"), 0, &Button) || m_EnterPressed) + if(DoButton_Menu(&s_JoinButton, Localize("Connect"), 0, &Button) || m_EnterPressed) { Client()->Connect(g_Config.m_UiServerAddress); m_EnterPressed = false; } - - // address info - /*MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(10.0f, 0, &Button); - UI()->DoLabelScaled(&Button, Localize("Host address"), 14.0f, -1); - MainView.HSplitTop(20.0f, &Button, &MainView); - static float Offset = 0.0f; - DoEditBox(&g_Config.m_UiServerAddress, &Button, g_Config.m_UiServerAddress, sizeof(g_Config.m_UiServerAddress), 14.0f, &Offset);*/ } void CMenus::RenderServerbrowser(CUIRect MainView) @@ -1317,7 +1431,7 @@ void CMenus::RenderServerbrowser(CUIRect MainView) CUIRect ServerList, ToolBox, BottomBox; MainView.HSplitTop(20.0f, 0, &MainView); - MainView.HSplitTop(MainView.h/2.0f, &ServerList, &MainView); + MainView.HSplitBottom(80.0f, &ServerList, &MainView); // server list diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index 8b2336243..b0ba534bd 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -29,23 +29,6 @@ int CMenus::DoButton_DemoPlayer(const void *pID, const char *pText, const CUIRec return UI()->DoButtonLogic(pID, pText, false, pRect); } -int CMenus::DoButton_Sprite(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, int Corners) -{ - float Seconds = 0.6f; // 0.6 seconds for fade - float *pFade = ButtonFade(pID, Seconds); - - RenderTools()->DrawUIRect(pRect, vec4(1.0f, 1.0f, 1.0f, 0.5f+(*pFade/Seconds)*0.25f), Corners, 5.0f); - Graphics()->TextureSet(g_pData->m_aImages[ImageID].m_Id); - Graphics()->QuadsBegin(); - Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.5f); - RenderTools()->SelectSprite(SpriteID); - IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h); - Graphics()->QuadsDrawTL(&QuadItem, 1); - Graphics()->QuadsEnd(); - - return UI()->DoButtonLogic(pID, "", false, pRect); -} - void CMenus::RenderDemoPlayer(CUIRect MainView) { const IDemoPlayer::CInfo *pInfo = DemoPlayer()->BaseInfo(); @@ -169,12 +152,12 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) static int s_PlayPauseButton = 0; if(!pInfo->m_Paused) { - if(DoButton_Sprite(&s_PlayPauseButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_PAUSE, &Button, CUI::CORNER_ALL)) + if(DoButton_SpriteID(&s_PlayPauseButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_PAUSE, &Button, CUI::CORNER_ALL)) DemoPlayer()->Pause(); } else { - if(DoButton_Sprite(&s_PlayPauseButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_PLAY, &Button, CUI::CORNER_ALL)) + if(DoButton_SpriteID(&s_PlayPauseButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_PLAY, &Button, CUI::CORNER_ALL)) DemoPlayer()->Unpause(); } @@ -183,7 +166,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) ButtonBar.VSplitLeft(Margins, 0, &ButtonBar); ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar); static int s_ResetButton = 0; - if(DoButton_Sprite(&s_ResetButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_STOP, &Button, CUI::CORNER_ALL)) + if(DoButton_SpriteID(&s_ResetButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_STOP, &Button, CUI::CORNER_ALL)) { m_pClient->OnReset(); DemoPlayer()->Pause(); @@ -194,14 +177,14 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) ButtonBar.VSplitLeft(Margins, 0, &ButtonBar); ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar); static int s_SlowDownButton = 0; - if(DoButton_Sprite(&s_SlowDownButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_SLOWER, &Button, CUI::CORNER_ALL) || Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN)) + if(DoButton_SpriteID(&s_SlowDownButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_SLOWER, &Button, CUI::CORNER_ALL) || Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN)) DecreaseDemoSpeed = true; // fastforward ButtonBar.VSplitLeft(Margins, 0, &ButtonBar); ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar); static int s_FastForwardButton = 0; - if(DoButton_Sprite(&s_FastForwardButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_FASTER, &Button, CUI::CORNER_ALL)) + if(DoButton_SpriteID(&s_FastForwardButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_FASTER, &Button, CUI::CORNER_ALL)) IncreaseDemoSpeed = true; // speed meter @@ -358,7 +341,7 @@ void CMenus::RenderDemoList(CUIRect MainView) Item.m_Rect.VSplitLeft(5.0f, 0, &Item.m_Rect); FileIcon.Margin(3.0f, &FileIcon); FileIcon.x += 3.0f; - DoButton_Icon(IMAGE_FILEICONS, r.front().m_IsDir?SPRITE_FILE_FOLDER:SPRITE_FILE_DEMO1, &FileIcon); + DoIcon(IMAGE_FILEICONS, r.front().m_IsDir?SPRITE_FILE_FOLDER:SPRITE_FILE_DEMO1, &FileIcon); if(!str_comp(m_lDemos[m_DemolistSelectedIndex].m_aName, r.front().m_aName)) { TextRender()->TextColor(0.0f, 0.0f, 0.0f, 1.0f); diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp index 40e52eece..bde061e7a 100644 --- a/src/game/client/components/menus_ingame.cpp +++ b/src/game/client/components/menus_ingame.cpp @@ -24,85 +24,88 @@ void CMenus::RenderGame(CUIRect MainView) { - CUIRect Button, ButtonBar; - MainView.HSplitTop(45.0f, &ButtonBar, &MainView); - RenderTools()->DrawUIRect(&ButtonBar, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 10.0f); + CUIRect Button, BottomView, Left, Middle, Right; - // button bar - ButtonBar.HSplitTop(10.0f, 0, &ButtonBar); - ButtonBar.HSplitTop(25.0f, &ButtonBar, 0); - ButtonBar.VMargin(10.0f, &ButtonBar); + // cut view + MainView.HSplitBottom(80.0f, &MainView, &BottomView); // MainView not used for now + BottomView.HSplitTop(20.f, 0, &BottomView); - ButtonBar.VSplitRight(120.0f, &ButtonBar, &Button); - static int s_DisconnectButton = 0; - if(DoButton_Menu(&s_DisconnectButton, Localize("Disconnect"), 0, &Button)) - Client()->Disconnect(); + float Spacing = 3.0f; + float ButtonWidth = (BottomView.w/6.0f)-(Spacing*5.0)/6.0f; - if(m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team != TEAM_SPECTATORS) + BottomView.VSplitLeft(ButtonWidth*3.0f+Spacing*2.0f, &Left, &Middle); + Middle.VSplitLeft(Spacing, 0, &Middle); + Middle.VSplitLeft(ButtonWidth, &Middle, &Right); + Right.VSplitRight(ButtonWidth, 0, &Right); + if(!(m_pClient->m_GameInfo.m_GameFlags&GAMEFLAG_TEAMS)) + Left.VSplitLeft(ButtonWidth, &Left, 0); + + // do backgrounds + RenderTools()->DrawUIRect4(&Left, vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), CUI::CORNER_T, 5.0f); + RenderTools()->DrawUIRect4(&Middle, vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), CUI::CORNER_T, 5.0f); + RenderTools()->DrawUIRect4(&Right, vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), CUI::CORNER_T, 5.0f); + + // do buttons + Left.HSplitTop(25.0f, &Left, 0); + Middle.HSplitTop(25.0f, &Middle, 0); + Right.HSplitTop(25.0f, &Right, 0); + + // join buttons + int Team = m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team; + Left.VSplitLeft(ButtonWidth, &Button, &Left); + Left.VSplitLeft(Spacing, 0, &Left); + static int s_SpectateButton = 0; + if(DoButton_Menu(&s_SpectateButton, Localize(Team != TEAM_SPECTATORS ? "Spectate" : "Spactating"), Team == TEAM_SPECTATORS, &Button) && Team != TEAM_SPECTATORS) { - ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar); - ButtonBar.VSplitLeft(120.0f, &Button, &ButtonBar); - static int s_SpectateButton = 0; - if(DoButton_Menu(&s_SpectateButton, Localize("Spectate"), 0, &Button)) - { - m_pClient->SendSwitchTeam(TEAM_SPECTATORS); - SetActive(false); - } + m_pClient->SendSwitchTeam(TEAM_SPECTATORS); + SetActive(false); } if(m_pClient->m_GameInfo.m_GameFlags&GAMEFLAG_TEAMS) { - if(m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team != TEAM_RED) + Left.VSplitLeft(ButtonWidth, &Button, &Left); + Left.VSplitLeft(Spacing, 0, &Left); + static int s_RedButton = 0; + if(DoButton_Menu(&s_RedButton, Localize(Team != TEAM_RED ? "Join red" : "Joined red"), Team == TEAM_RED, &Button, CUI::CORNER_ALL, 5.0f, 0.0f, vec4(0.975f, 0.17f, 0.17f, 0.75f), false) && Team != TEAM_RED) { - ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar); - ButtonBar.VSplitLeft(120.0f, &Button, &ButtonBar); - static int s_SpectateButton = 0; - if(DoButton_Menu(&s_SpectateButton, Localize("Join red"), 0, &Button)) - { - m_pClient->SendSwitchTeam(TEAM_RED); - SetActive(false); - } + m_pClient->SendSwitchTeam(TEAM_RED); + SetActive(false); } - if(m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team != TEAM_BLUE) + Left.VSplitLeft(ButtonWidth, &Button, &Left); + static int s_BlueButton = 0; + if(DoButton_Menu(&s_BlueButton, Localize(Team != TEAM_BLUE ? "Join blue" : "Joined blue"), Team == TEAM_BLUE, &Button, CUI::CORNER_ALL, 5.0f, 0.0f, vec4(0.17f, 0.46f, 0.975f, 0.75f), false) && Team != TEAM_BLUE) { - ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar); - ButtonBar.VSplitLeft(120.0f, &Button, &ButtonBar); - static int s_SpectateButton = 0; - if(DoButton_Menu(&s_SpectateButton, Localize("Join blue"), 0, &Button)) - { - m_pClient->SendSwitchTeam(TEAM_BLUE); - SetActive(false); - } + m_pClient->SendSwitchTeam(TEAM_BLUE); + SetActive(false); } } else { - if(m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team != 0) + Left.VSplitLeft(ButtonWidth, &Button, &Left); + static int s_JoinButton = 0; + if(DoButton_Menu(&s_JoinButton, Localize(Team != TEAM_RED ? "Join" : "Joined"), Team == TEAM_RED, &Button) && Team != TEAM_RED) { - ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar); - ButtonBar.VSplitLeft(120.0f, &Button, &ButtonBar); - static int s_SpectateButton = 0; - if(DoButton_Menu(&s_SpectateButton, Localize("Join game"), 0, &Button)) - { - m_pClient->SendSwitchTeam(0); - SetActive(false); - } + m_pClient->SendSwitchTeam(0); + SetActive(false); } } - ButtonBar.VSplitLeft(100.0f, 0, &ButtonBar); - ButtonBar.VSplitLeft(150.0f, &Button, &ButtonBar); - + // Record button static int s_DemoButton = 0; bool Recording = DemoRecorder()->IsRecording(); - if(DoButton_Menu(&s_DemoButton, Localize(Recording ? "Stop record" : "Record demo"), 0, &Button)) // Localize("Stop record");Localize("Record demo"); + if(DoButton_Menu(&s_DemoButton, Localize(Recording ? "Stop record" : "Record"), Recording, &Middle)) { if(!Recording) Client()->DemoRecorder_Start("demo", true); else Client()->DemoRecorder_Stop(); } + + // disconnect button + static int s_DisconnectButton = 0; + if(DoButton_Menu(&s_DisconnectButton, Localize("Disconnect"), 0, &Right)) + Client()->Disconnect(); } void CMenus::RenderPlayers(CUIRect MainView) diff --git a/src/game/variables.h b/src/game/variables.h index eaff3cb31..b26bb4a6e 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -60,7 +60,7 @@ MACRO_CONFIG_STR(PlayerSkinFeet, player_skin_feet, 24, "standard", CFGFLAG_CLIEN MACRO_CONFIG_STR(PlayerSkinEyes, player_skin_eyes, 24, "standard", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Player skin eyes") //MACRO_CONFIG_INT(UiPage, ui_page, 6, 0, 10, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface page") -MACRO_CONFIG_INT(UiBrowserPage, ui_browser_page, 6, 6, 8, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface serverbrowser page") +MACRO_CONFIG_INT(UiBrowserPage, ui_browser_page, 5, 5, 8, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface serverbrowser page") MACRO_CONFIG_INT(UiSettingsPage, ui_settings_page, 0, 0, 5, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface settings page") //MACRO_CONFIG_INT(UiToolboxPage, ui_toolbox_page, 0, 0, 2, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Toolbox page") MACRO_CONFIG_STR(UiServerAddress, ui_server_address, 64, "localhost:8303", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface server address")