From 6e3f50efeb9dd828c912b74871f2bbf39e8aeda4 Mon Sep 17 00:00:00 2001 From: "ardi@ist-einmalig.de" Date: Thu, 7 May 2009 22:46:54 +0000 Subject: [PATCH] new Tooltip-Handling, change Widescreen-sizing to mathematically correct value (0.75 alias 1.333), new Clock-Font --- source/FreeTypeGX.cpp | 6 +- source/FreeTypeGX.h | 2 +- source/cfg.c | 2 +- source/filelist.h | 21 ++++-- source/fonts/clock.ttf | Bin 4816 -> 4228 bytes source/images/tooltip.png | Bin 1289 -> 0 bytes source/images/tooltip_large.png | Bin 1608 -> 0 bytes source/images/tooltip_left.png | Bin 0 -> 676 bytes source/images/tooltip_medium.png | Bin 1441 -> 0 bytes source/images/tooltip_right.png | Bin 0 -> 896 bytes source/images/tooltip_tile.png | Bin 0 -> 148 bytes source/libwiigui/gui.h | 20 ++++-- source/libwiigui/gui_button.cpp | 40 +++++++++++ source/libwiigui/gui_image.cpp | 4 +- source/libwiigui/gui_text.cpp | 6 +- source/libwiigui/gui_tooltip.cpp | 47 +++++++----- source/menu.cpp | 119 ++++++++++++++----------------- 17 files changed, 164 insertions(+), 103 deletions(-) delete mode 100644 source/images/tooltip.png delete mode 100644 source/images/tooltip_large.png create mode 100644 source/images/tooltip_left.png delete mode 100644 source/images/tooltip_medium.png create mode 100644 source/images/tooltip_right.png create mode 100644 source/images/tooltip_tile.png diff --git a/source/FreeTypeGX.cpp b/source/FreeTypeGX.cpp index 0cbab38e..bcce941c 100644 --- a/source/FreeTypeGX.cpp +++ b/source/FreeTypeGX.cpp @@ -205,10 +205,10 @@ void FreeTypeGX::unloadFont() { this->fontData.clear(); } -void FreeTypeGX::changeSize(FT_UInt pointSize) { +void FreeTypeGX::changeSize(FT_UInt vPointSize, FT_UInt hPointSize/*=0*/) { this->unloadFont(); - this->ftPointSize = pointSize; - FT_Set_Pixel_Sizes(this->ftFace, 0, this->ftPointSize); + this->ftPointSize = vPointSize; + FT_Set_Pixel_Sizes(this->ftFace, hPointSize, this->ftPointSize); } /** diff --git a/source/FreeTypeGX.h b/source/FreeTypeGX.h index 935cd7d0..07c88eae 100644 --- a/source/FreeTypeGX.h +++ b/source/FreeTypeGX.h @@ -270,7 +270,7 @@ class FreeTypeGX { uint16_t loadFont(uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, bool cacheAll = false); uint16_t loadFont(const uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, bool cacheAll = false); - void changeSize(FT_UInt pointSize); + void changeSize(FT_UInt vPointSize, FT_UInt hPointSize=0); uint16_t drawText(int16_t x, int16_t y, wchar_t *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL); uint16_t drawText(int16_t x, int16_t y, wchar_t const *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL); diff --git a/source/cfg.c b/source/cfg.c index 004cae6b..e8542b7c 100644 --- a/source/cfg.c +++ b/source/cfg.c @@ -248,7 +248,7 @@ void CFG_Default(int widescreen) // -1 = non forced Mode THEME.info_g = 154; THEME.info_b = 192; THEME.clock_x = 0; - THEME.clock_y = -128; + THEME.clock_y = 330; THEME.clockAlign = CFG_ALIGN_CENTRE; THEME.sdcard_x = 160; THEME.sdcard_y = 390; diff --git a/source/filelist.h b/source/filelist.h index ec5f6708..a0584971 100644 --- a/source/filelist.h +++ b/source/filelist.h @@ -53,8 +53,17 @@ extern const u32 button_click_pcm_size; extern const u8 button_click2_pcm[]; extern const u32 button_click2_pcm_size; -extern const u8 tooltip_png[]; -extern const u32 tooltip_png_size; +///extern const u8 tooltip_png[]; +///extern const u32 tooltip_png_size; + +extern const u8 tooltip_left_png[]; +extern const u32 tooltip_left_png_size; + +extern const u8 tooltip_tile_png[]; +extern const u32 tooltip_tile_png_size; + +extern const u8 tooltip_right_png[]; +extern const u32 tooltip_right_png_size; extern const u8 startgame_arrow_left_png[]; extern const u32 startgame_arrow_left_png_size; @@ -62,11 +71,11 @@ extern const u32 startgame_arrow_left_png_size; extern const u8 startgame_arrow_right_png[]; extern const u32 startgame_arrow_right_png_size; -extern const u8 tooltip_medium_png[]; -extern const u32 tooltip_medium_png_size; +///extern const u8 tooltip_medium_png[]; +///extern const u32 tooltip_medium_png_size; -extern const u8 tooltip_large_png[]; -extern const u32 tooltip_large_png_size; +///extern const u8 tooltip_large_png[]; +///extern const u32 tooltip_large_png_size; extern const u8 credits_bg_png[]; extern const u32 credits_bg_png_size; diff --git a/source/fonts/clock.ttf b/source/fonts/clock.ttf index d68319e106be3be5f673d169a300a324ecccd389..5a252b2b62a3e9e94f8662a34fd8ceebb5be76fb 100644 GIT binary patch literal 4228 zcmd5rb?X~K^ zdN)pt`T%WEBS;|<$|Io<6&0eO(5h8XQxx$h^8gYOSU?_v;HCU10+l{d@AA#uUGLi7 zMCu!NcjlfsGk4~E-#KUQTw+9|(U(c4XFora9DMP)&)p+IoJi{9yY@^u31m4~Sz$ z`NliN2hRjDA7WmPi;lki(?9e3FF%$19(58)ihKo4FG*aB3(v?`Dx>H*jQ&nZ5i{9+ zb{!C!0D7H5A(4x+5lX@D86am*)M32$@Ylm_3@=r5p$U|CY!Xy zEunX-mf!)Vp!zr324xz`RD;a*yKRh}!4tI=6ICP=&~SDVq|hgEci_%|AFEa>Xq%L( zR4RY1{H{74D&`QxK*F8RS7S?PxU#-XO{J&~r_1f}`uti=^?!1&5%O`($*QU%OVqn@ z(!3>ipX|yN;$4MjC;EDK+ji45Z&&V)hJKV~M@Rd5P4iZEG<1s{<;uQZc58COd;(8S z<_hLHK2g``EvcIi$d8`y%W8(9>s~Jdqk+Il_R4Km`Rc~W!bJQn$va6$-ja#e3gfjZ zG!CJ03XLnk^==`1gx)7)zZj_rxkZc#iaI3pVNpj!Z&cK+qBkbwxTxFs7}(MH2Z7SN z>?N|KNeK}mKgoVmxz4^VrJ#?J#?qB*m6Mg%=^c8W{hpnvJckH=K-b8^?_%V=^VITEMw%y@<+GdmexsAVUE|3KvL}w=*~rWA}~Zls5Ij)Ujm3V&|rkhF0F3`k+EqBFU~M zl3SK$S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_{zp?~ZV@O(xW?PLWWftzk|baUMis zRWT|ppkfqj$A225HIq2YN7W9&FW~KlINfNEh7^lnt+zx&xHcL=#_U$Qh;Jnu?C=m3 zJh@%WlPg>*3=bD@{T{d5xbSstQHK3Q`>`D77vJE_GgRQXau_e3Vdd4;pRTTM$75_S z3N3SE<;KGUC_cvw5B@Bssmp-bPU=Es}?Sd?A)2!xpPGJnf9C5 zHBMm1LM9SW!CdVh80g0}(T{C3QH*U8H+d{Emm@Lk!>T(PttN@xT(MSj)r}GRp@Yt| zZu&A!Ix_rBFF`|f4A*2vNxJQ{Yhc3-N9OQ-wcS-WM#r1)I%C`vr;i*N^FwER8oPXW zh0tHgN`ECQ{gtfrSF+My$x44EEB%!$=C8ndGc-$QX`V{7Ortc1+8k9-n}@!lw?wCC z5hE(7Phv+fN7Hl~@=;pC6JmT>_8p-y8o(}hV8bkpbF9zM@cf?TnNnrul=bX+>qzpM3yKfSmx(_2~W!~oeS&I-y?K=v%1M|lLe z&eJopZ5Cw@+6HL5JbNKql$XdWu)_}O!+8#)=3$*hT7c9Gt1O~b%`*o13|gM2&G4qP zSGT{5@3Y4pqLpD3$2u6HD7E1qhZwbk9Ub_0A&K4j7W}6Wl6!bY2oMavj;ul_NxQ6_ Vtv82-!^Tmt?T4fL_c@_K^iRq@I%WU> diff --git a/source/images/tooltip.png b/source/images/tooltip.png deleted file mode 100644 index 8bd8cf13cb50c1c80c99c9431cb9a3683884ccb3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1289 zcmV+k1@`)hP)(=PaI;l@%}P0cn8rj5H~#s$z)y062L64-gn+C@D0bE_{?~hzA_g281A2AQ+!hDz$Oc73{Qr@#PLzi;g#>U3l?(XjI68!To=ES@dyL38z zi*VMxuNel^KctlO>fqquF9~+-hq*Q<&Ejm~c&U zA1lGLu9z=#o}Zt8MA%(AQxqAZFplQoh6K*KV!oJ7d`sBfBxljmfsLxdI9eu<)}Lsq zF?TE$>mvM(MOgy7W!z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wg2{+5ytVKhs3A9U+sokW{Hwq8_>(ZB2VA>dagtj8>msQ4E#q51q1~p4uyCu$R zCGMT#0sDF7qL-7g$yQW_6xH08^5DDDiF%nrxrIg(Xwv-hjRizWwW+}Uurg|li{bmW z`ggBlwn5^!PU8BG#Ces(eYtobubhif$!KRYN;FP+c(rt-Mml8{F0rZ0dJ;2=1hAd=JX4bIs^CzmX)IhyHK>2!F|r4ALr>UDWnL^PZi-%#lA#`}KW z`@KK+9z4&3%BD2@KcE&MxlJ-f@{r^aNinM}8k!)vPx5$PU?_m(3dw`X4_mF)nQhw_ zj^kYQdcE)C@z|Tyf`o68JRvDe(>%2->)dtS>)~+tYhGwzfaIRv<955<>~_1~f`kSF z7oJh()w)jA8hLl*^7 za^+ksGkg*_BqG z9u>+DJJ0iA7)DCzajolmQt1x|K%`!;zgG6k^gIulOeWfBG(IT%=>v%9y1t|A+5#W~ zV5M9xKT~$`lE`YUR(qr5>gbOGK(tsaK38)2^+y39mdoXK4a4}j)a$zhd}K}2w4|=< zZd-)61ykC2NK;34BP-k<@~J6@@>c#2M}Kvm;+5>Q8~I8fY=`$k{Tj#)R-Lr0000< KMNUMnLSTX(Ha6`5 literal 0 HcmV?d00001 diff --git a/source/images/tooltip_medium.png b/source/images/tooltip_medium.png deleted file mode 100644 index f663779f2939c3ecddd9b4d216fd853850b22c20..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1441 zcmV;S1z!4zP)ZqF(vn(R?Lua{=s-V+SwvbCTCI^#WW+=a ziHW*!-Tly&n{M1z+Lc@BN)%>O7Zo9m(|hFq?8}!)OvaDo|KJCKVa)T)`OUreymRln zaf25xURUEWzaJbN{B?YM{F;#K#L>~w z-;%qM!;;IA(@Ank&Q}&&rdEYZzF=)_?We7+tzY){_y3H=V*l_Tg_IJK(~{egyqj!5o{1LA@>v9z?*m6udlGo2VI zKZrpkm9-hcT;ET4`JsV_Y*4 zlDekS3Kh%C%Y#aps*FX*>ydeTnB4hTZBcT{L?N*<4= zLn%~)QR-Bv9#r;TGGK&cM_dtSd_LcMN}*az{Svz(q)Cv$A|yNFia6u<`#)C-)nk-8 z73yR^6T8L<$qjKuoCyYlUn_-fVU#)*N;XNz zJRW1P2+65)B8IMsAC*G4G3}#JgcL!jRz(A+e1sHd%4fkkibV-R3Mon~E-rqn6q4@q zMwZP9DX?tr^ZA~p6N(RZ2|34u-SP4957P<7)+0jB(R$=`Iv=G7#pYN-@^6j}1OhIl z&b^ePgj|tGq=(x#2+4i>hTHA_NU38>DVxisY^&!6Lqc-jVA$Q={f<(nJ>|hJu8L?h z`Z2e_6Ow%kyw~fM>Yi-fu%@&gY1h!ukU3SH%Gz)EN>IKMv=mi7G{TrQW>ZnwXSQKh=h9UXmpa&q#6xw*Mf*%LycDAaW$91ef41ae8S!R>ZC2L=WnL!vH- zWW%V`iUPz3r;5~3SEe)9Wj1T z0>6`%r}r_fvmuwQ$n6&7x*54|EJUVsYbpcEgtd5}bqlQ*w{Zg&43AcD=YqM5pxE%a z{Sxk>RB2C&Zz;r9%hNXGZYy%R3AtU5T(3dy=e%ahRVw{xrHN(67dPN08gWCHK{NhW zX~E|v!uaMuBXYL^xop;nlsqaGEYn$H88D};!H`%B>MjX$5_N>}%>gZMO~~bH-H7x? vL^?|>y<7$ueVJ4PBVl~=z>p+SULySmFlkU!lsG%800000NkvXXu0mjf?c}oa diff --git a/source/images/tooltip_right.png b/source/images/tooltip_right.png new file mode 100644 index 0000000000000000000000000000000000000000..7fd7806506553b0717066ebb5404f01cd0808bea GIT binary patch literal 896 zcmV-`1AqL9P)1RCt{2mp@2bQ542Mti?#_V!PP1lHEp%CfE`K#kMW z)8B`Ohdc5#>+9=70BRfq2qCPCi;F*oVf>Pi&CShs0BUXn-5DT+uuRjuOr=r>J3Bj3 zB8sf8t`6S@DGMMYl}a7RlOz%e4}jWIkct4NX?d8yg!l z03H;BR1A>aC0jTc47M|*pe9uTgb-FTncO9!$nx^?H~^P~I0ndMGRJ&3J_B$As8g+~ z8j#QD&*fMNhr?a~4eBYX1_&W6!!Y)UC=!pyUjb-jt7-w%I08tg(?>)U(KPKnfEM)> zjsUXR>C)9*@u404_%_+T!Bk8^;0asPOy!qmEl7hg~9( z2mlyxyvTA~heDyZ0QwzmQ}w|a85wyF;IU&DO?@(>(daw?FMwW0Muqz5>$)CxyWKv; zp6Z94y0%PBO^tE(eE>SE8rSy4Yi@3C0>ChUC${X%e{k%pV=NY10PvJs(*xiUdtd&O zXUpdateEffects(); } void GuiButton::DrawTooltip() +{ + LOCK(this); + if(state == STATE_SELECTED && (toolTip || toolTip2)) + { + if (time2 == 0) + { + time(&time1); + time2 = time1; + } + if(time1 != 0) // timer läuft + time(&time1); + + if(time1 == 0 || difftime(time1, time2) >= 2) + { + if(time1 != 0) // timer gerade abgelaufen + if(toolTip2) toolTip2->SetEffect(EFFECT_FADE, 20); + time1 = 0; + if(toolTip2) toolTip2->Draw(); + if(toolTip) toolTip->Draw(); + if (toolTipTxt) + { + toolTipTxt->Draw(); + } + return; + } + } + else + { + if(time2 != 0 && time1 == 0) // timer abgelaufen, gerade DESELECT + if(toolTip2) toolTip2->SetEffect(EFFECT_FADE, -20); + time2 = 0; + } + if(toolTip2 && toolTip2->GetEffect()) + toolTip2->Draw(); +} +/* +void GuiButton::DrawTooltip() { LOCK(this); if(state == STATE_SELECTED && (toolTip || toolTip2)) @@ -226,6 +265,7 @@ void GuiButton::DrawTooltip() else time2 = 0; } +*/ void GuiButton::ScrollIsOn(int f) { LOCK(this); diff --git a/source/libwiigui/gui_image.cpp b/source/libwiigui/gui_image.cpp index b150bb11..2673af8e 100644 --- a/source/libwiigui/gui_image.cpp +++ b/source/libwiigui/gui_image.cpp @@ -233,7 +233,7 @@ void GuiImage::Draw() if(tile > 0) { for(int i=0; iGetTop(), width, height, image, imageangle, widescreen ? currScale*0.8 : currScale, currScale, this->GetAlpha()); + Menu_DrawImg(currLeft+width*i, this->GetTop(), width, height, image, imageangle, widescreen ? currScale*0.75 : currScale, currScale, this->GetAlpha()); } else { @@ -241,7 +241,7 @@ void GuiImage::Draw() if(scale != 1) currLeft = currLeft - width/2 + (width*scale)/2; - Menu_DrawImg(currLeft, this->GetTop(), width, height, image, imageangle, widescreen ? currScale*0.8 : currScale, currScale, this->GetAlpha()); + Menu_DrawImg(currLeft, this->GetTop(), width, height, image, imageangle, widescreen ? currScale*0.75 : currScale, currScale, this->GetAlpha()); } if(stripe > 0) diff --git a/source/libwiigui/gui_text.cpp b/source/libwiigui/gui_text.cpp index cdf3dfb9..d7e1d526 100644 --- a/source/libwiigui/gui_text.cpp +++ b/source/libwiigui/gui_text.cpp @@ -30,6 +30,7 @@ GuiText::GuiText(const char * t, int s, GXColor c) style = FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE; maxWidth = 0; font = NULL; + widescreen = 0; //added alignmentHor = ALIGN_CENTRE; alignmentVert = ALIGN_MIDDLE; @@ -50,6 +51,7 @@ GuiText::GuiText(const char * t) style = presetStyle; maxWidth = presetMaxWidth; font = NULL; + widescreen = 0; //added alignmentHor = presetAlignmentHor; alignmentVert = presetAlignmentVert; @@ -166,7 +168,7 @@ int GuiText::GetTextWidth() if(newSize != currentSize) { //fontSystem->changeSize(newSize); - (font ? font : fontSystem)->changeSize(newSize); + (font ? font : fontSystem)->changeSize(newSize, widescreen ? (newSize*3)>>2 : 0); currentSize = newSize; } return (font ? font : fontSystem)->getWidth(text); @@ -192,7 +194,7 @@ void GuiText::Draw() if(newSize != currentSize) { //fontSystem->changeSize(newSize); - (font ? font : fontSystem)->changeSize(newSize); + (font ? font : fontSystem)->changeSize(newSize, widescreen ? (newSize*3)>>2 : 0); currentSize = newSize; } diff --git a/source/libwiigui/gui_tooltip.cpp b/source/libwiigui/gui_tooltip.cpp index 137e0717..20bc310d 100644 --- a/source/libwiigui/gui_tooltip.cpp +++ b/source/libwiigui/gui_tooltip.cpp @@ -10,18 +10,23 @@ #include "gui.h" -GuiImageData GuiTooltip::tooltipStd(tooltip_png); -GuiImageData GuiTooltip::tooltipMedium(tooltip_medium_png); -GuiImageData GuiTooltip::tooltipLarge(tooltip_large_png); +static GuiImageData tooltipLeft(tooltip_left_png); +static GuiImageData tooltipTile(tooltip_tile_png); +static GuiImageData tooltipRight(tooltip_right_png); /** * Constructor for the GuiTooltip class. */ GuiTooltip::GuiTooltip(const char *t) +: +leftImage(&tooltipLeft), tileImage(&tooltipTile), rightImage(&tooltipRight) { text = NULL; - image.SetParent(this); + height = leftImage.GetHeight(); + leftImage.SetParent(this); + tileImage.SetParent(this); + rightImage.SetParent(this); SetText(t); } @@ -33,6 +38,16 @@ GuiTooltip::~GuiTooltip() if(text) delete text; } +float GuiTooltip::GetScale() +{ + float s = scale * scaleDyn; + +// if(parentElement) +// s *= parentElement->GetScale(); + + return s; +} + /* !Sets the text of the GuiTooltip element * !\param t Text */ @@ -44,24 +59,20 @@ void GuiTooltip::SetText(const char * t) delete text; text = NULL; } - int t_width = 24; + int tile_cnt = 0; if(t && (text = new GuiText(t, 22, (GXColor){0, 0, 0, 255}))) { text->SetParent(this); - t_width += text->GetTextWidth(); + tile_cnt = (text->GetTextWidth()-12) /tileImage.GetWidth(); + if(tile_cnt < 0) tile_cnt = 0; } - - if(t_width > tooltipMedium.GetWidth()) - image.SetImage(&tooltipLarge); - else if(t_width > tooltipStd.GetWidth()) - image.SetImage(&tooltipMedium); - else - image.SetImage(&tooltipStd); - image.SetPosition(0, 0); - width = image.GetWidth(); - height = image.GetHeight(); + tileImage.SetPosition(leftImage.GetWidth(), 0); + tileImage.SetTile(tile_cnt); + rightImage.SetPosition(leftImage.GetWidth() + tile_cnt * tileImage.GetWidth(), 0); + width = leftImage.GetWidth() + tile_cnt * tileImage.GetWidth() + rightImage.GetWidth(); } +void GuiTooltip::SetWidescreen(short){} /* * Draw the Tooltip on screen */ @@ -70,7 +81,9 @@ void GuiTooltip::Draw() LOCK(this); if(!this->IsVisible()) return; - image.Draw(); + leftImage.Draw(); + tileImage.Draw(); + rightImage.Draw(); if(text) text->Draw(); this->UpdateEffects(); diff --git a/source/menu.cpp b/source/menu.cpp index e656d0d4..3ace63ee 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -1530,7 +1530,7 @@ ShowProgress (s32 done, s32 total) // timeTxt.SetFont(fontClock); if ((Settings.wsprompt == yes) && (CFG.widescreen)){ - progressbarImg.SetTile(80*done/total);} + progressbarImg.SetTile(75*done/total);} else {progressbarImg.SetTile(100*done/total);} } @@ -1774,7 +1774,7 @@ ProgressDownloadWindow(int choice2) if ((Settings.wsprompt == yes) && (CFG.widescreen)){/////////////adjust for widescreen progressbarImg.SetPosition(80,40); - progressbarImg.SetTile(80*i/cntMissFiles); + progressbarImg.SetTile(75*i/cntMissFiles); } else{ progressbarImg.SetTile(100*i/cntMissFiles);} @@ -2355,7 +2355,8 @@ static int MenuDiscList() struct tm * timeinfo; char theTime[80]; int counter = 0; - + time_t lastrawtime=0; + WBFS_DiskSpace(&used, &freespace); if (!gameCnt) { //if there is no list of games to display @@ -2407,17 +2408,9 @@ static int MenuDiscList() gamecntTxt.SetAlignment(THEME.gameCntAlign, ALIGN_TOP); gamecntTxt.SetPosition(THEME.gameCnt_x,THEME.gameCnt_y); - GuiImageData tooltipLarge(tooltip_large_png); - GuiImage tooltipLargeImg(&tooltipLarge); - if (Settings.wsprompt == yes){ - tooltipLargeImg.SetWidescreen(CFG.widescreen);}/////////// - - GuiText ttinstallTxt("Install a game", 22, (GXColor){0, 0, 0, 255}); //TOOLTIP DATA FOR INSTALL BUTTON - GuiImageData ttinstall(tooltip_medium_png); - GuiImage ttinstallImg(&ttinstall); - if (Settings.wsprompt == yes){ - ttinstallImg.SetWidescreen(CFG.widescreen);}/////////// - + GuiTooltip installBtnTT("Install a game"); + if (Settings.wsprompt == yes) + installBtnTT.SetWidescreen(CFG.widescreen);/////////// GuiImage installBtnImg(&btnInstall); GuiImage installBtnImgOver(&btnInstallOver); installBtnImg.SetWidescreen(CFG.widescreen); //added @@ -2432,13 +2425,11 @@ static int MenuDiscList() installBtn.SetTrigger(&trigA); installBtn.SetEffectGrow(); if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - installBtn.SetToolTip(&ttinstallImg,&ttinstallTxt,175,-30); + installBtn.SetToolTip(&installBtnTT,24,-30, ALIGN_LEFT); - GuiText ttsettingsTxt("Settings", 22, (GXColor){0, 0, 0, 255}); //TOOLTIP DATA FOR SETTINGS BUTTON - GuiImageData ttsettings(tooltip_png); - GuiImage ttsettingsImg(&ttsettings); - ttsettingsImg.SetWidescreen(CFG.widescreen); - GuiTooltip tt_settings("Settings"); + GuiTooltip settingsBtnTT("Settings"); + if (Settings.wsprompt == yes) + settingsBtnTT.SetWidescreen(CFG.widescreen);/////////// GuiImage settingsBtnImg(&btnSettings); settingsBtnImg.SetWidescreen(CFG.widescreen); //added @@ -2453,15 +2444,12 @@ static int MenuDiscList() settingsBtn.SetSoundClick(&btnClick); settingsBtn.SetTrigger(&trigA); settingsBtn.SetEffectGrow(); -// if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) -// settingsBtn.SetToolTip(&ttsettingsImg,&ttsettingsTxt,65,-30); if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - settingsBtn.SetToolTip(&tt_settings,65,-30); + settingsBtn.SetToolTip(&settingsBtnTT,65,-30); - GuiText tthomeTxt("Back to HBC or Wii Menu", 22, (GXColor){0, 0, 0, 255}); //TOOLTIP DATA FOR HOME BUTTON - GuiImageData tthome(tooltip_large_png); - GuiImage tthomeImg(&tthome); - tthomeImg.SetWidescreen(CFG.widescreen); + GuiTooltip homeBtnTT("Back to HBC or Wii Menu"); + if (Settings.wsprompt == yes) + homeBtnTT.SetWidescreen(CFG.widescreen);/////////// GuiImage homeBtnImg(&btnhome); homeBtnImg.SetWidescreen(CFG.widescreen); //added @@ -2478,12 +2466,11 @@ static int MenuDiscList() homeBtn.SetTrigger(&trigHome); homeBtn.SetEffectGrow(); if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - homeBtn.SetToolTip(&tthomeImg,&tthomeTxt,15,-30); + homeBtn.SetToolTip(&homeBtnTT,15,-30); - GuiText ttpoweroffTxt("Power off the Wii", 22, (GXColor){0, 0, 0, 255}); //TOOLTIP DATA FOR POWER BUTTON - GuiImageData ttpoweroff(tooltip_medium_png); - GuiImage ttpoweroffImg(&ttpoweroff); - ttpoweroffImg.SetWidescreen(CFG.widescreen); + GuiTooltip poweroffBtnTT("Power off the Wii"); + if (Settings.wsprompt == yes) + poweroffBtnTT.SetWidescreen(CFG.widescreen);/////////// GuiImage poweroffBtnImg(&btnpwroff); @@ -2500,13 +2487,12 @@ static int MenuDiscList() poweroffBtn.SetTrigger(&trigA); poweroffBtn.SetEffectGrow(); if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - poweroffBtn.SetToolTip(&ttpoweroffImg,&ttpoweroffTxt,-10,-30); + poweroffBtn.SetToolTip(&poweroffBtnTT,-10,-30); - GuiText ttsdcardTxt("Reload SD", 22, (GXColor){0, 0, 0, 255}); //TOOLTIP DATA FOR SETTINGS BUTTON - GuiImageData ttsdcard(tooltip_png); - GuiImage ttsdcardImg(&ttsdcard); - ttsdcardImg.SetWidescreen(CFG.widescreen); + GuiTooltip sdcardBtnTT("Reload SD"); + if (Settings.wsprompt == yes) + sdcardBtnTT.SetWidescreen(CFG.widescreen);/////////// GuiImage sdcardImg(&btnsdcard); sdcardImg.SetWidescreen(CFG.widescreen); @@ -2519,26 +2505,26 @@ static int MenuDiscList() sdcardBtn.SetTrigger(&trigA); sdcardBtn.SetEffectGrow(); if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - sdcardBtn.SetToolTip(&ttsdcardImg,&ttsdcardTxt,95,-40); + sdcardBtn.SetToolTip(&sdcardBtnTT,95,-40); //Downloading Covers - GuiText ttDownloadTxt("Click to Download Covers", 20, (GXColor){0, 0, 0, 255}); //TOOLTIP DATA FOR DOWNLOAD - GuiImageData ttDownload(tooltip_large_png); - GuiImage ttDownloadImg(&ttDownload); - ttDownloadImg.SetWidescreen(CFG.widescreen); + GuiTooltip DownloadBtnTT("Click to Download Covers"); + if (Settings.wsprompt == yes) + DownloadBtnTT.SetWidescreen(CFG.widescreen);/////////// GuiButton DownloadBtn(160,224); DownloadBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP); DownloadBtn.SetPosition(THEME.cover_x,THEME.cover_y);//(20, 300); - DownloadBtn.SetSoundOver(&btnSoundOver); - if (CFG.godmode == 1){//only make the button have trigger & tooltip if in godmode - DownloadBtn.SetTrigger(&trigA); - if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0){ - DownloadBtn.SetToolTip(&ttDownloadImg,&ttDownloadTxt,205,-30); + if (CFG.godmode == 1) + {//only make the button have trigger & tooltip if in godmode + DownloadBtn.SetSoundOver(&btnSoundOver); + DownloadBtn.SetTrigger(&trigA); + if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) + DownloadBtn.SetToolTip(&DownloadBtnTT,205,-30); } - } - + else + DownloadBtn.SetRumble(false); #ifdef HW_RVL int i = 0, level; char txt[3]; @@ -2585,12 +2571,12 @@ static int MenuDiscList() gameBrowser.SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); GuiText clockTimeBack("88:88", 40, (GXColor){138, 138, 138, 40}); - clockTimeBack.SetAlignment(THEME.clockAlign, ALIGN_BOTTOM); + clockTimeBack.SetAlignment(THEME.clockAlign, ALIGN_TOP); clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y); clockTimeBack.SetFont(fontClock); GuiText clockTime(theTime, 40, (GXColor){138, 138, 138, 240}); - clockTime.SetAlignment(THEME.clockAlign, ALIGN_BOTTOM); + clockTime.SetAlignment(THEME.clockAlign, ALIGN_TOP); clockTime.SetPosition(THEME.clock_x, THEME.clock_y); clockTime.SetFont(fontClock); @@ -2642,10 +2628,14 @@ static int MenuDiscList() VIDEO_WaitVSync (); //CLOCK - if ((Settings.hddinfo == Clock)&&(counter % 2000 == 0)) {//only update the clock every 2000 loops - time_t rawtime = time(0); //this fixes code dump caused by the clock - timeinfo = localtime (&rawtime); - strftime(theTime, sizeof(theTime), "%H:%M", timeinfo); + time_t rawtime = time(0); //this fixes code dump caused by the clock + if (Settings.hddinfo == Clock && rawtime != lastrawtime) {//only update the clock every 2000 loops + lastrawtime = rawtime; + timeinfo = localtime (&rawtime); + if(rawtime & 1) + strftime(theTime, sizeof(theTime), "%H:%M", timeinfo); + else + strftime(theTime, sizeof(theTime), "%H %M", timeinfo); clockTime.SetText(theTime); } counter++; @@ -3469,12 +3459,12 @@ static int MenuSettings() page1Btn.SetSoundClick(&btnClick); page1Btn.SetTrigger(&trigA); - GuiImageData ttpage(tooltip_png); - GuiText ttpage1Txt("Go to Page 1", 20, (GXColor){0, 0, 0, 255}); - GuiImage ttpage1Img(&ttpage); + GuiTooltip page1BtnTT("Go to Page 1"); + if (Settings.wsprompt == yes) + page1BtnTT.SetWidescreen(CFG.widescreen);/////////// - if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - page1Btn.SetToolTip(&ttpage1Img,&ttpage1Txt,105, 15); + if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) + page1Btn.SetToolTip(&page1BtnTT,105, 15); GuiImage page2Img(&page2); @@ -3487,11 +3477,12 @@ static int MenuSettings() page2Btn.SetSoundClick(&btnClick); page2Btn.SetTrigger(&trigA); - GuiText ttpage2Txt("Go to Page 2", 20, (GXColor){0, 0, 0, 255}); - GuiImage ttpage2Img(&ttpage); + GuiTooltip page2BtnTT("Go to Page 2"); + if (Settings.wsprompt == yes) + page2BtnTT.SetWidescreen(CFG.widescreen);/////////// - if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - page2Btn.SetToolTip(&ttpage2Img,&ttpage2Txt,105,0); + if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) + page2Btn.SetToolTip(&page2BtnTT,105,0); ////////////////////////////////