Add in input displays for gameplay HUD, showing current hotkeys for abilities and items. Updated class info menu to show current inputs. Added slight outlines to mouse control icons. Release Build 7574.

pull/35/head
sigonasr2 9 months ago
parent 0861419582
commit e317b7b23b
  1. 13
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 9
      Adventures in Lestoria/CharacterAbilityPreviewComponent.h
  3. 2
      Adventures in Lestoria/CharacterRotatingDisplay.h
  4. 43
      Adventures in Lestoria/Key.cpp
  5. 5
      Adventures in Lestoria/Key.h
  6. 5
      Adventures in Lestoria/TODO.txt
  7. 2
      Adventures in Lestoria/Version.h
  8. BIN
      Adventures in Lestoria/assets/themes/lmb.png
  9. BIN
      Adventures in Lestoria/assets/themes/mmb.png
  10. BIN
      Adventures in Lestoria/assets/themes/rmb.png
  11. BIN
      x64/Release/Adventures in Lestoria.exe

@ -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*/){ 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; bool circle=loadoutSlot==-1;
if(a.name!="???"){ 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){ if(a.cooldown>0.1){
vf2d iconScale={1,1}; vf2d iconScale={1,1};
if(loadoutSlot!=-1)iconScale={0.7f,0.7f}; if(loadoutSlot!=-1)iconScale={0.7f,0.7f};
@ -1649,9 +1659,6 @@ void AiL::RenderCooldowns(){
DrawShadowStringDecal(pos+vf2d{20,4}-manaCostSize/2,std::to_string(a.manaCost),{192,192,255},manaCostShadowCol,{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<float>::max(),1);
vf2d shortNameSize=vf2d{GetTextSize(a.shortName)}*vf2d{0.5f,0.75f}; 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}); DrawShadowStringDecal(pos+vf2d{13,24}-shortNameSize/2,a.shortName,shortNameCol,{255,255,255,230},{0.5f,0.75f});
} }

@ -70,10 +70,9 @@ protected:
window.DrawShadowStringPropDecal(descriptionPos,ability->description,WHITE,BLACK,{0.8f,1.f},int(rect.size.x-(descriptionPos.x-rect.pos.x))-4); window.DrawShadowStringPropDecal(descriptionPos,ability->description,WHITE,BLACK,{0.8f,1.f},int(rect.size.x-(descriptionPos.x-rect.pos.x))-4);
if(textWidth>boxWidth){ InputType controlType=KEY;
window.DrawShadowStringPropDecal(textPos,ability->input->GetDisplayName(),WHITE,BLACK,{boxWidth/textWidth*0.5f,0.5}); if(Input::UsingGamepad())controlType=CONTROLLER;
}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});
}
} }
}; };

@ -50,7 +50,7 @@ protected:
float perspectiveFactor=6; float perspectiveFactor=6;
public: public:
inline CharacterRotatingDisplay(geom2d::rect<float>rect,Decal*icon) inline CharacterRotatingDisplay(geom2d::rect<float>rect,Decal*icon)
:MenuComponent(rect,"",DO_NOTHING),icon(icon){} :MenuComponent(rect,"",DO_NOTHING,ButtonAttr::UNSELECTABLE),icon(icon){}
inline void SetIcon(Decal*icon){ inline void SetIcon(Decal*icon){
this->icon=icon; this->icon=icon;
} }

@ -302,7 +302,7 @@ std::string InputGroup::GetDisplayName(){
return combinationDisplay; return combinationDisplay;
} }
void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*const>renderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha,InputType type)const{ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*const,ViewPort*const>renderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha,InputType type,vf2d textScale)const{
std::optional<Input>primaryKey; std::optional<Input>primaryKey;
switch(type){ switch(type){
case CONTROLLER:primaryKey=GetPrimaryKey(CONTROLLER);break; case CONTROLLER:primaryKey=GetPrimaryKey(CONTROLLER);break;
@ -326,7 +326,7 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
buttonImgSize.y=std::max(buttonImgSize.y,float(input.GetIcon().Sprite()->height)); buttonImgSize.y=std::max(buttonImgSize.y,float(input.GetIcon().Sprite()->height));
buttonImgs.push_back(input.GetIcon().Decal()); buttonImgs.push_back(input.GetIcon().Decal());
}else{ }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); buttonImgSize.y=std::max(buttonImgSize.y,float(game->GetTextSizeProp(input.GetDisplayName()).y)+"Interface.InputHelperSpacing"_F);
buttonImgs.push_back(input.GetDisplayName()); buttonImgs.push_back(input.GetDisplayName());
} }
@ -345,7 +345,7 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
buttonImgSize.y=std::max(buttonImgSize.y,float(primaryKey.value().GetIcon().Sprite()->height)); buttonImgSize.y=std::max(buttonImgSize.y,float(primaryKey.value().GetIcon().Sprite()->height));
buttonImgs.push_back(primaryKey.value().GetIcon().Decal()); buttonImgs.push_back(primaryKey.value().GetIcon().Decal());
}else{ }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); buttonImgSize.y=std::max(buttonImgSize.y,float(game->GetTextSizeProp(primaryKey.value().GetDisplayName()).y)+"Interface.InputHelperSpacing"_F);
buttonImgs.push_back(primaryKey.value().GetDisplayName()); buttonImgs.push_back(primaryKey.value().GetDisplayName());
} }
@ -359,19 +359,22 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
#pragma region Render Macro #pragma region Render Macro
#define Render(rendererType) \ #define Render(rendererType) \
std::get<rendererType*const>(renderer)->DrawDecal(pos+offset-vf2d{0.f,2.f},img,{1.f,1.f},{255,255,255,alpha}); std::get<rendererType*const>(renderer)->DrawDecal(pos+offset-vf2d{0.f,2.f},img,textScale,{255,255,255,alpha});
#pragma endregion #pragma endregion
if(std::holds_alternative<AiL*const>(renderer)){ if(std::holds_alternative<AiL*const>(renderer)){
Render(AiL); Render(AiL);
}else }else
if(std::holds_alternative<TileTransformedView*const>(renderer)){ if(std::holds_alternative<TileTransformedView*const>(renderer)){
Render(TileTransformedView); Render(TileTransformedView);
} }else
offset.x+=img->sprite->width+"Interface.InputHelperSpacing"_I; if(std::holds_alternative<ViewPort*const>(renderer)){
Render(ViewPort);
}else ERR("Could not find proper renderer for rendering Inputs!");
offset.x+=img->sprite->width*textScale.x+"Interface.InputHelperSpacing"_I;
}else }else
if(std::holds_alternative<std::string>(button)){ if(std::holds_alternative<std::string>(button)){
std::string label=std::get<std::string>(button); std::string label=std::get<std::string>(button);
vf2d textSize=game->GetTextSizeProp(label); vf2d textSize=game->GetTextSizeProp(label)*textScale;
Pixel buttonBackCol="Interface.InputButtonBackCol"_Pixel; Pixel buttonBackCol="Interface.InputButtonBackCol"_Pixel;
Pixel buttonTextCol="Interface.InputButtonTextCol"_Pixel; Pixel buttonTextCol="Interface.InputButtonTextCol"_Pixel;
buttonBackCol.a=alpha; buttonBackCol.a=alpha;
@ -382,7 +385,7 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
std::get<rendererType*const>(renderer)->FillRectDecal(pos+offset+vf2d{-2.f,0.f},vf2d{textSize.x+4,textSize.y},buttonBackCol); \ std::get<rendererType*const>(renderer)->FillRectDecal(pos+offset+vf2d{-2.f,0.f},vf2d{textSize.x+4,textSize.y},buttonBackCol); \
std::get<rendererType*const>(renderer)->FillRectDecal(pos+offset+vf2d{-1.f,-1.f},vf2d{textSize.x+2,textSize.y},buttonBackCol); \ std::get<rendererType*const>(renderer)->FillRectDecal(pos+offset+vf2d{-1.f,-1.f},vf2d{textSize.x+2,textSize.y},buttonBackCol); \
std::get<rendererType*const>(renderer)->FillRectDecal(pos+offset+vf2d{-1.f,0.f},vf2d{textSize.x+2,textSize.y+1.f},buttonBackCol); \ std::get<rendererType*const>(renderer)->FillRectDecal(pos+offset+vf2d{-1.f,0.f},vf2d{textSize.x+2,textSize.y+1.f},buttonBackCol); \
std::get<rendererType*const>(renderer)->DrawStringPropDecal(pos+offset+vf2d{0.f,0.f},label,buttonTextCol); std::get<rendererType*const>(renderer)->DrawStringPropDecal(pos+offset+vf2d{0.f,0.f},label,buttonTextCol,textScale);
#pragma endregion #pragma endregion
if(std::holds_alternative<AiL*const>(renderer)){ if(std::holds_alternative<AiL*const>(renderer)){
@ -390,15 +393,33 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
}else }else
if(std::holds_alternative<TileTransformedView*const>(renderer)){ if(std::holds_alternative<TileTransformedView*const>(renderer)){
Render(TileTransformedView); Render(TileTransformedView);
} }else
if(std::holds_alternative<ViewPort*const>(renderer)){
Render(ViewPort);
}else ERR("Could not find proper renderer for rendering Inputs!");
offset.x+=textSize.x+"Interface.InputHelperSpacing"_I; 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!"); }else [[unlikely]]ERR("WARNING! Hit a state where no data is inside of the button! THIS SHOULD NOT BE HAPPENING!");
} }
game->view.DrawShadowStringPropDecal(pos+offset,displayText,{255,255,255,alpha},{0,0,0,alpha}); #pragma region Render Display Text
#pragma region Render Macro
#define Render(rendererType) \
std::get<rendererType*const>(renderer)->DrawShadowStringPropDecal(pos+offset,displayText,{255,255,255,alpha},{0,0,0,alpha},textScale);
#pragma endregion
if(std::holds_alternative<AiL*const>(renderer)){
Render(AiL);
}else
if(std::holds_alternative<TileTransformedView*const>(renderer)){
Render(TileTransformedView);
}else
if(std::holds_alternative<ViewPort*const>(renderer)){
Render(ViewPort);
}else ERR("Could not find proper renderer for rendering Inputs!");
#pragma endregion
} }
void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*const>renderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha)const{ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*const,ViewPort*const>renderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha)const{
InputType primaryType; InputType primaryType;
if(Input::UsingGamepad())primaryType=CONTROLLER; if(Input::UsingGamepad())primaryType=CONTROLLER;
else if(Menu::UsingMouseNavigation())primaryType=MOUSE; else if(Menu::UsingMouseNavigation())primaryType=MOUSE;

@ -44,6 +44,7 @@ All rights reserved.
#include "olcPGEX_TransformedView.h" #include "olcPGEX_TransformedView.h"
#include <variant> #include <variant>
#include "IconType.h" #include "IconType.h"
#include "olcPGEX_ViewPort.h"
class AiL; class AiL;
@ -119,8 +120,8 @@ public:
const float AnalogDAS(const float threshold=0.2f); const float AnalogDAS(const float threshold=0.2f);
std::string GetDisplayName(); std::string GetDisplayName();
//Draws an input display with accompanying text centered at given position. //Draws an input display with accompanying text centered at given position.
void DrawInput(const std::variant<AiL*const,TileTransformedView*const>renderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha)const; void DrawInput(const std::variant<AiL*const,TileTransformedView*const,ViewPort*const>renderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha)const;
void DrawInput(const std::variant<AiL*const,TileTransformedView*const>renderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha,const InputType type)const; void DrawInput(const std::variant<AiL*const,TileTransformedView*const,ViewPort*const>renderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha,const InputType type,vf2d textScale={1.f,1.f})const;
const std::optional<Input>GetPrimaryKey(InputType type)const; const std::optional<Input>GetPrimaryKey(InputType type)const;
}; };

@ -6,18 +6,13 @@ January 1st
- Track items used during a stage, on death, restore the loadout item quantities used. - 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 Add Bonus XP when completing a stage
January 31st January 31st
============ ============
- Loading Screen
- Title Screen setpieces - Title Screen setpieces
- Hide mouse cursor during controller play. Reveal it again during mouse play. - 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. - Auto aim causes retreat-type moves to aim away from the auto target, and prefer the direction the player's moving in.

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 3 #define VERSION_MINOR 3
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 7558 #define VERSION_BUILD 7574
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Loading…
Cancel
Save