From 69dbab6c19ced294622526c7b2c3bea3b1654266 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Tue, 5 Apr 2022 13:07:32 +0200 Subject: [PATCH] Missed some stuff. --- language.version | 4 ++-- zscript/menu/swwm_menus.zsc | 39 ++++++++++++++++++++++++------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/language.version b/language.version index 14229f463..aa7b758ce 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r17 \cu(Tue 5 Apr 12:29:16 CEST 2022)\c-"; -SWWM_SHORTVER="\cw1.3pre r17 \cu(2022-04-05 12:29:16)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r18 \cu(Tue 5 Apr 13:07:32 CEST 2022)\c-"; +SWWM_SHORTVER="\cw1.3pre r18 \cu(2022-04-05 13:07:32)\c-"; diff --git a/zscript/menu/swwm_menus.zsc b/zscript/menu/swwm_menus.zsc index cfbe55b77..cef09ced7 100644 --- a/zscript/menu/swwm_menus.zsc +++ b/zscript/menu/swwm_menus.zsc @@ -175,7 +175,15 @@ Class OptionMenuItemSWWMPlayTime : OptionMenuItem // option menu /w tooltips Class SWWMOptionMenu : OptionMenu { - private String ttip; + private String ttip, olttip; + private Font mTipFont; + private BrokenLines ttlines; + + override void Init( Menu parent, OptionMenuDescriptor desc ) + { + Super.Init(parent,desc); + mTipFont = Font.GetFont('TewiFont'); + } override void Ticker() { @@ -185,13 +193,16 @@ Class SWWMOptionMenu : OptionMenu String mcvar = mDesc.mItems[mDesc.mSelectedItem].GetAction(); mcvar.Replace(" ","_"); // need to strip whitespace for command actions String locstr = String.Format("TOOLTIP_%s",mcvar); + olttip = ttip; ttip = StringTable.Localize(locstr,false); if ( ttip == locstr ) ttip = ""; + if ( (ttip != olttip) && ttlines ) ttlines.Destroy(); + if ( !ttlines ) ttlines = mTipFont.BreakLines(ttip,CleanWidth_1-8); } override void Drawer() { Super.Drawer(); - if ( ttip == "" ) return; + if ( (ttip == "") || !ttlines ) return; // re-evaluate y to check where the cursor is int cy = 0; int y = mDesc.mPosition; @@ -220,22 +231,20 @@ Class SWWMOptionMenu : OptionMenu break; } } - let lines = smallfont.BreakLines(ttip,CleanWidth_1-8); - int height = (4+smallfont.GetHeight()*lines.Count())*CleanYFac_1; + int height = (4+mTipFont.GetHeight()*ttlines.Count())*CleanYFac_1; // draw at the bottom unless the selected option could be covered by the tooltip int ypos = Screen.GetHeight()-height; if ( cy > ypos ) ypos = 0; Screen.Dim("Black",.75,0,ypos,Screen.GetWidth(),height); ypos += 2*CleanYFac_1; - for ( int i=0; i 0 ) { - if ( isclean ) Screen.DrawText(smallfont,Font.CR_FIRE,x,y+16*CleanYFac_1,str,DTA_CleanNoMove_1,true); - else Screen.DrawText(smallfont,Font.CR_FIRE,x,y+16,str,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43); + if ( isclean ) Screen.DrawText(mSmallFont,Font.CR_FIRE,x,y+16*CleanYFac_1,str,DTA_CleanNoMove_1,true); + else Screen.DrawText(mSmallFont,Font.CR_FIRE,x,y+16,str,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43); } if ( ofs < (mDesc.mItems.Size()-8) ) { str = "⌄ ⌄ ⌄"; - if ( isclean ) Screen.DrawText(smallfont,Font.CR_FIRE,x,y+256*CleanYFac_1,str,DTA_CleanNoMove_1,true); - else Screen.DrawText(smallfont,Font.CR_FIRE,x,y+256,str,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43); + if ( isclean ) Screen.DrawText(mSmallFont,Font.CR_FIRE,x,y+256*CleanYFac_1,str,DTA_CleanNoMove_1,true); + else Screen.DrawText(mSmallFont,Font.CR_FIRE,x,y+256,str,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43); } for ( int i=0; i