From 8783aad55fe5d4a0658d4c94228de69d8189b05e Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Thu, 13 Jan 2022 15:40:17 +0100 Subject: [PATCH] Some small cleanup. --- graphics/DemoIcon.png | Bin 683 -> 703 bytes language.version | 4 +- zscript/menu/swwm_menus.zsc | 84 ++++++++++++++---------------------- 3 files changed, 35 insertions(+), 53 deletions(-) diff --git a/graphics/DemoIcon.png b/graphics/DemoIcon.png index e04035f95fd079db6f14721bfab9b1a9aa0dd776..569e6a148ff311af93a5a80144af41fa8d6df722 100644 GIT binary patch delta 28 hcmZ3@x}SA|iXcaNkz*1A1A_wyubEu3f1_d-698{N2o3-M delta 10 Rcmdnbx|(%@%0`QJCIA(<1DgN< diff --git a/language.version b/language.version index 136b3008c..c90478aec 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\chSWWM \czGZ\c- \cw1.2pre r107 \cu(Thu 13 Jan 00:27:14 CET 2022)\c-"; -SWWM_SHORTVER="\cw1.2pre r107 \cu(2022-01-13 00:27:14)\c-"; +SWWM_MODVER="\chSWWM \czGZ\c- \cw1.2pre r108 \cu(Thu 13 Jan 15:40:17 CET 2022)\c-"; +SWWM_SHORTVER="\cw1.2pre r108 \cu(2022-01-13 15:40:17)\c-"; diff --git a/zscript/menu/swwm_menus.zsc b/zscript/menu/swwm_menus.zsc index 49ba9f0e7..4e1e39004 100644 --- a/zscript/menu/swwm_menus.zsc +++ b/zscript/menu/swwm_menus.zsc @@ -749,9 +749,40 @@ Class SWWMMessageBox : MessageBoxMenu } } +Mixin Class SWWMSelector +{ + override void DrawSelector( double xofs, double yofs, TextureID tex, ListMenuDescriptor desc ) + { + if ( tex.isNull() ) return; + int w = desc?desc.DisplayWidth():ListMenuDescriptor.CleanScale; + int h = desc?desc.DisplayHeight():-1; + double y = mYpos+mHeight/2; + if ( w == ListMenuDescriptor.CleanScale ) + { + xofs *= CleanXFac_1; + yofs *= CleanYFac_1; + double x = (320-GetWidth())/2; + SWWMUtility.AdjustClean_1(x,y); + Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_Rotate,15.*sin(8*Menu.MenuTime())); + x = (320+GetWidth())/2; + SWWMUtility.AdjustClean_1x(x); + Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_Rotate,-15.*sin(8*Menu.MenuTime())); + } + else + { + double x = (w-GetWidth())/2; + Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_Rotate,15.*sin(8*Menu.MenuTime())); + x = (w+GetWidth())/2; + Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_Rotate,-15.*sin(8*Menu.MenuTime())); + } + } +} + // main menu item with wiggly text when selected and Demo face selectors on both sides class ListMenuItemSWWMTextItemM : ListMenuItemSelectable { + Mixin SWWMSelector; + String mText; Font mFont; int mColor; @@ -834,36 +865,13 @@ class ListMenuItemSWWMTextItemM : ListMenuItemSelectable else Screen.DrawText(font,mColor,x,y,text,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43); } - override void DrawSelector( double xofs, double yofs, TextureID tex, ListMenuDescriptor desc ) - { - if ( tex.isNull() ) return; - int w = desc?desc.DisplayWidth():ListMenuDescriptor.CleanScale; - int h = desc?desc.DisplayHeight():-1; - double y = mYpos+mHeight/2; - if ( w == ListMenuDescriptor.CleanScale ) - { - xofs *= CleanXFac_1; - yofs *= CleanYFac_1; - double x = (320-GetWidth())/2; - SWWMUtility.AdjustClean_1(x,y); - Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_CenterOffset,true,DTA_Rotate,15.*sin(8*Menu.MenuTime())); - x = (320+GetWidth())/2; - SWWMUtility.AdjustClean_1x(x); - Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_CenterOffset,true,DTA_Rotate,-15.*sin(8*Menu.MenuTime())); - } - else - { - double x = (w-GetWidth())/2; - Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_CenterOffset,true,DTA_Rotate,15.*sin(8*Menu.MenuTime())); - x = (w+GetWidth())/2; - Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_CenterOffset,true,DTA_Rotate,-15.*sin(8*Menu.MenuTime())); - } - } } // for compat with non-text episodes (no longer used?) Class ListMenuItemSWWMPatchItemM : ListMenuItemSelectable { + Mixin SWWMSelector; + TextureID mTexture; void Init( ListMenuDescriptor desc, TextureID patch, String hotkey, Name child, int param = 0 ) @@ -901,32 +909,6 @@ Class ListMenuItemSWWMPatchItemM : ListMenuItemSelectable screen.DrawTexture(mTexture,true,x,mYpos,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43); } } - - override void DrawSelector( double xofs, double yofs, TextureID tex, ListMenuDescriptor desc ) - { - if ( tex.isNull() ) return; - int w = desc?desc.DisplayWidth():ListMenuDescriptor.CleanScale; - int h = desc?desc.DisplayHeight():-1; - double y = mYpos+mHeight/2; - if ( w == ListMenuDescriptor.CleanScale ) - { - xofs *= CleanXFac_1; - yofs *= CleanYFac_1; - double x = (320-GetWidth())/2; - SWWMUtility.AdjustClean_1(x,y); - Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_CenterOffset,true,DTA_Rotate,15.*sin(8*Menu.MenuTime())); - x = (320+GetWidth())/2; - SWWMUtility.AdjustClean_1x(x); - Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_CenterOffset,true,DTA_Rotate,-15.*sin(8*Menu.MenuTime())); - } - else - { - double x = (w-GetWidth())/2; - Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_CenterOffset,true,DTA_Rotate,15.*sin(8*Menu.MenuTime())); - x = (w+GetWidth())/2; - Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_CenterOffset,true,DTA_Rotate,-15.*sin(8*Menu.MenuTime())); - } - } } Class OptionMenuItemTrapOption : OptionMenuItem