diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index d8ac2e94..ec724ba3 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -1583,6 +1583,16 @@ void AiL::RenderCooldowns(){ const auto DrawCooldown=[&](vf2d pos,Ability&a,int loadoutSlot=-1/*Set to 0-2 to get an item slot rendered instead*/){ bool circle=loadoutSlot==-1; if(a.name!="???"){ + + vf2d keyDisplaySize=vf2d{GetTextSize(a.input->GetDisplayName())}*vf2d{0.5f,0.5f}; + InputType controlType=KEY; + if(Input::UsingGamepad())controlType=CONTROLLER; + vf2d drawOffset={}; + if(loadoutSlot!=-1){ + drawOffset.y+=2.f; + } + a.input->DrawInput(game,pos+vf2d{14,0.f}+drawOffset,"",255,controlType,{0.75f,0.75f}); + if(a.cooldown>0.1){ vf2d iconScale={1,1}; if(loadoutSlot!=-1)iconScale={0.7f,0.7f}; @@ -1648,9 +1658,6 @@ void AiL::RenderCooldowns(){ vf2d manaCostSize=vf2d{GetTextSize(std::to_string(a.manaCost))}*vf2d{0.5f,0.75f}; DrawShadowStringDecal(pos+vf2d{20,4}-manaCostSize/2,std::to_string(a.manaCost),{192,192,255},manaCostShadowCol,{0.5f,0.75f}); } - - vf2d keyDisplaySize=vf2d{GetTextSize(a.input->GetDisplayName())}*vf2d{0.5f,0.5f}; - DrawShadowStringDecal(pos+vf2d{12,-2}-keyDisplaySize/2,a.input->GetDisplayName(),keyDisplayCol,BLACK,{0.5f,0.5f},std::numeric_limits::max(),1); vf2d shortNameSize=vf2d{GetTextSize(a.shortName)}*vf2d{0.5f,0.75f}; DrawShadowStringDecal(pos+vf2d{13,24}-shortNameSize/2,a.shortName,shortNameCol,{255,255,255,230},{0.5f,0.75f}); diff --git a/Adventures in Lestoria/CharacterAbilityPreviewComponent.h b/Adventures in Lestoria/CharacterAbilityPreviewComponent.h index 8a53b925..a9b4ae0f 100644 --- a/Adventures in Lestoria/CharacterAbilityPreviewComponent.h +++ b/Adventures in Lestoria/CharacterAbilityPreviewComponent.h @@ -69,11 +69,10 @@ protected: vi2d descriptionPos=iconPos+vi2d{int(rect.size.y)-2,-1}; window.DrawShadowStringPropDecal(descriptionPos,ability->description,WHITE,BLACK,{0.8f,1.f},int(rect.size.x-(descriptionPos.x-rect.pos.x))-4); + + InputType controlType=KEY; + if(Input::UsingGamepad())controlType=CONTROLLER; - if(textWidth>boxWidth){ - window.DrawShadowStringPropDecal(textPos,ability->input->GetDisplayName(),WHITE,BLACK,{boxWidth/textWidth*0.5f,0.5}); - }else{ - window.DrawShadowStringPropDecal(textPos,ability->input->GetDisplayName(),WHITE,BLACK,{0.5,0.5}); - } + ability->input->DrawInput(&window,textPos+vf2d{boxWidth/2,7},"",255,controlType,{0.5f,0.5f}); } }; \ No newline at end of file diff --git a/Adventures in Lestoria/CharacterRotatingDisplay.h b/Adventures in Lestoria/CharacterRotatingDisplay.h index 65d8ddc9..8c5fffe6 100644 --- a/Adventures in Lestoria/CharacterRotatingDisplay.h +++ b/Adventures in Lestoria/CharacterRotatingDisplay.h @@ -50,7 +50,7 @@ protected: float perspectiveFactor=6; public: inline CharacterRotatingDisplay(geom2d::rectrect,Decal*icon) - :MenuComponent(rect,"",DO_NOTHING),icon(icon){} + :MenuComponent(rect,"",DO_NOTHING,ButtonAttr::UNSELECTABLE),icon(icon){} inline void SetIcon(Decal*icon){ this->icon=icon; } diff --git a/Adventures in Lestoria/Key.cpp b/Adventures in Lestoria/Key.cpp index 9d0e79ee..5b7e8091 100644 --- a/Adventures in Lestoria/Key.cpp +++ b/Adventures in Lestoria/Key.cpp @@ -302,7 +302,7 @@ std::string InputGroup::GetDisplayName(){ return combinationDisplay; } -void InputGroup::DrawInput(const std::variantrenderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha,InputType type)const{ +void InputGroup::DrawInput(const std::variantrenderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha,InputType type,vf2d textScale)const{ std::optionalprimaryKey; switch(type){ case CONTROLLER:primaryKey=GetPrimaryKey(CONTROLLER);break; @@ -326,7 +326,7 @@ void InputGroup::DrawInput(const std::variantheight)); buttonImgs.push_back(input.GetIcon().Decal()); }else{ - buttonImgSize.x+=game->GetTextSizeProp(input.GetDisplayName()).x+"Interface.InputHelperSpacing"_F; + buttonImgSize.x+=game->GetTextSizeProp(input.GetDisplayName()).x*textScale.x+"Interface.InputHelperSpacing"_F; buttonImgSize.y=std::max(buttonImgSize.y,float(game->GetTextSizeProp(input.GetDisplayName()).y)+"Interface.InputHelperSpacing"_F); buttonImgs.push_back(input.GetDisplayName()); } @@ -345,7 +345,7 @@ void InputGroup::DrawInput(const std::variantheight)); buttonImgs.push_back(primaryKey.value().GetIcon().Decal()); }else{ - buttonImgSize.x+=game->GetTextSizeProp(primaryKey.value().GetDisplayName()).x+"Interface.InputHelperSpacing"_F; + buttonImgSize.x+=game->GetTextSizeProp(primaryKey.value().GetDisplayName()).x*textScale.x+"Interface.InputHelperSpacing"_F; buttonImgSize.y=std::max(buttonImgSize.y,float(game->GetTextSizeProp(primaryKey.value().GetDisplayName()).y)+"Interface.InputHelperSpacing"_F); buttonImgs.push_back(primaryKey.value().GetDisplayName()); } @@ -359,19 +359,22 @@ void InputGroup::DrawInput(const std::variant(renderer)->DrawDecal(pos+offset-vf2d{0.f,2.f},img,{1.f,1.f},{255,255,255,alpha}); + std::get(renderer)->DrawDecal(pos+offset-vf2d{0.f,2.f},img,textScale,{255,255,255,alpha}); #pragma endregion if(std::holds_alternative(renderer)){ Render(AiL); }else if(std::holds_alternative(renderer)){ Render(TileTransformedView); - } - offset.x+=img->sprite->width+"Interface.InputHelperSpacing"_I; + }else + if(std::holds_alternative(renderer)){ + Render(ViewPort); + }else ERR("Could not find proper renderer for rendering Inputs!"); + offset.x+=img->sprite->width*textScale.x+"Interface.InputHelperSpacing"_I; }else if(std::holds_alternative(button)){ std::string label=std::get(button); - vf2d textSize=game->GetTextSizeProp(label); + vf2d textSize=game->GetTextSizeProp(label)*textScale; Pixel buttonBackCol="Interface.InputButtonBackCol"_Pixel; Pixel buttonTextCol="Interface.InputButtonTextCol"_Pixel; buttonBackCol.a=alpha; @@ -382,7 +385,7 @@ void InputGroup::DrawInput(const std::variant(renderer)->FillRectDecal(pos+offset+vf2d{-2.f,0.f},vf2d{textSize.x+4,textSize.y},buttonBackCol); \ std::get(renderer)->FillRectDecal(pos+offset+vf2d{-1.f,-1.f},vf2d{textSize.x+2,textSize.y},buttonBackCol); \ std::get(renderer)->FillRectDecal(pos+offset+vf2d{-1.f,0.f},vf2d{textSize.x+2,textSize.y+1.f},buttonBackCol); \ - std::get(renderer)->DrawStringPropDecal(pos+offset+vf2d{0.f,0.f},label,buttonTextCol); + std::get(renderer)->DrawStringPropDecal(pos+offset+vf2d{0.f,0.f},label,buttonTextCol,textScale); #pragma endregion if(std::holds_alternative(renderer)){ @@ -390,15 +393,33 @@ void InputGroup::DrawInput(const std::variant(renderer)){ Render(TileTransformedView); - } + }else + if(std::holds_alternative(renderer)){ + Render(ViewPort); + }else ERR("Could not find proper renderer for rendering Inputs!"); offset.x+=textSize.x+"Interface.InputHelperSpacing"_I; }else [[unlikely]]ERR("WARNING! Hit a state where no data is inside of the button! THIS SHOULD NOT BE HAPPENING!"); } + + #pragma region Render Display Text + #pragma region Render Macro + #define Render(rendererType) \ + std::get(renderer)->DrawShadowStringPropDecal(pos+offset,displayText,{255,255,255,alpha},{0,0,0,alpha},textScale); + #pragma endregion - game->view.DrawShadowStringPropDecal(pos+offset,displayText,{255,255,255,alpha},{0,0,0,alpha}); + if(std::holds_alternative(renderer)){ + Render(AiL); + }else + if(std::holds_alternative(renderer)){ + Render(TileTransformedView); + }else + if(std::holds_alternative(renderer)){ + Render(ViewPort); + }else ERR("Could not find proper renderer for rendering Inputs!"); + #pragma endregion } -void InputGroup::DrawInput(const std::variantrenderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha)const{ +void InputGroup::DrawInput(const std::variantrenderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha)const{ InputType primaryType; if(Input::UsingGamepad())primaryType=CONTROLLER; else if(Menu::UsingMouseNavigation())primaryType=MOUSE; diff --git a/Adventures in Lestoria/Key.h b/Adventures in Lestoria/Key.h index 489c7333..6fbb6e79 100644 --- a/Adventures in Lestoria/Key.h +++ b/Adventures in Lestoria/Key.h @@ -44,6 +44,7 @@ All rights reserved. #include "olcPGEX_TransformedView.h" #include #include "IconType.h" +#include "olcPGEX_ViewPort.h" class AiL; @@ -119,8 +120,8 @@ public: const float AnalogDAS(const float threshold=0.2f); std::string GetDisplayName(); //Draws an input display with accompanying text centered at given position. - void DrawInput(const std::variantrenderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha)const; - void DrawInput(const std::variantrenderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha,const InputType type)const; + void DrawInput(const std::variantrenderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha)const; + void DrawInput(const std::variantrenderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha,const InputType type,vf2d textScale={1.f,1.f})const; const std::optionalGetPrimaryKey(InputType type)const; }; diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 0d9779e7..2d897922 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -6,18 +6,13 @@ January 1st - Track items used during a stage, on death, restore the loadout item quantities used. -- Icon displays / Proper key displays above skill keys - Add Bonus XP when completing a stage January 31st ============ - -- Loading Screen - Title Screen setpieces - - Hide mouse cursor during controller play. Reveal it again during mouse play. - Auto aim causes retreat-type moves to aim away from the auto target, and prefer the direction the player's moving in. diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 47aa673f..41dad1ec 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 7558 +#define VERSION_BUILD 7574 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/themes/lmb.png b/Adventures in Lestoria/assets/themes/lmb.png index e2894bb5..b249127a 100644 Binary files a/Adventures in Lestoria/assets/themes/lmb.png and b/Adventures in Lestoria/assets/themes/lmb.png differ diff --git a/Adventures in Lestoria/assets/themes/mmb.png b/Adventures in Lestoria/assets/themes/mmb.png index ec7cae05..93c9fdb5 100644 Binary files a/Adventures in Lestoria/assets/themes/mmb.png and b/Adventures in Lestoria/assets/themes/mmb.png differ diff --git a/Adventures in Lestoria/assets/themes/rmb.png b/Adventures in Lestoria/assets/themes/rmb.png index fc695402..04f24be2 100644 Binary files a/Adventures in Lestoria/assets/themes/rmb.png and b/Adventures in Lestoria/assets/themes/rmb.png differ diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index c9962b48..ae87eb67 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ