Add transparent overlay feedback when an ability/item ability key is held down. Item icon scale/quantity text scale now scales with the item icon box size.

pull/28/head
sigonasr2 12 months ago
parent e4c777f60a
commit c11417d8a0
  1. 9
      Crawler/Crawler.cpp
  2. 1
      Crawler/Item.cpp
  3. 6
      Crawler/MenuIconButton.h
  4. 5
      Crawler/MenuItemButton.h
  5. 13
      Crawler/MenuItemItemButton.h
  6. 2
      Crawler/Player.cpp
  7. 1
      Crawler/Player.h
  8. 2
      Crawler/Turret.cpp
  9. 2
      Crawler/Version.h

@ -1268,6 +1268,13 @@ void Crawler::RenderCooldowns(){
Decal*overlayIcon=GFX["skill_overlay_icon.png"].Decal(); Decal*overlayIcon=GFX["skill_overlay_icon.png"].Decal();
if(!circle)overlayIcon=GFX["square_skill_overlay_icon.png"].Decal(); if(!circle)overlayIcon=GFX["square_skill_overlay_icon.png"].Decal();
DrawDecal(pos,overlayIcon); DrawDecal(pos,overlayIcon);
if(a.input->Held()){
if(circle){
DrawPie(pos+vf2d{12,12},12,0,{255,255,255,64});
}else{
DrawSquarePie(pos+vf2d{12,12},10,0,{255,255,255,64});
}
}
Pixel shortNameCol=BLUE,manaCostShadowCol=DARK_BLUE,keyDisplayCol=YELLOW; Pixel shortNameCol=BLUE,manaCostShadowCol=DARK_BLUE,keyDisplayCol=YELLOW;
if(player->GetMana()<a.manaCost){ if(player->GetMana()<a.manaCost){
@ -2024,10 +2031,12 @@ void Crawler::InitializeGraphics(){
squareCircleCooldownPoints.push_back({0,0}); squareCircleCooldownPoints.push_back({0,0});
for(int i=0;i<=360;i+=4){ for(int i=0;i<=360;i+=4){
float angle=util::degToRad(float(i))-PI/2; float angle=util::degToRad(float(i))-PI/2;
if(i==0){circleCooldownPoints.push_back(vf2d{cos(angle),sin(angle)});}
circleCooldownPoints.push_back(vf2d{cos(angle),sin(angle)}); circleCooldownPoints.push_back(vf2d{cos(angle),sin(angle)});
vf2d point=vf2d{cos(angle),sin(angle)}*sqrt(2.1f); vf2d point=vf2d{cos(angle),sin(angle)}*sqrt(2.1f);
point.x=std::clamp(point.x,-1.f,1.f); point.x=std::clamp(point.x,-1.f,1.f);
point.y=std::clamp(point.y,-1.f,1.f); point.y=std::clamp(point.y,-1.f,1.f);
if(i==0){squareCircleCooldownPoints.push_back(point);}
squareCircleCooldownPoints.push_back(point); squareCircleCooldownPoints.push_back(point);
} }

@ -40,6 +40,7 @@ All rights reserved.
#include "DEFINES.h" #include "DEFINES.h"
#include "Crawler.h" #include "Crawler.h"
#include "Menu.h" #include "Menu.h"
#include "Ability.h"
INCLUDE_game INCLUDE_game
INCLUDE_DATA INCLUDE_DATA

@ -63,7 +63,8 @@ protected:
if(!decal){ if(!decal){
MenuComponent::Draw(game,parentPos); MenuComponent::Draw(game,parentPos);
if(icon!=nullptr){ if(icon!=nullptr){
game->DrawSprite(parentPos+rect.middle()-icon->sprite->Size()/2,icon->sprite,1,Sprite::Flip::NONE); vi2d iconScale=rect.size/24;
game->DrawSprite(parentPos+rect.middle()-icon->sprite->Size()*iconScale/2,icon->sprite,iconScale.x,Sprite::Flip::NONE);
} }
} }
} }
@ -71,7 +72,8 @@ protected:
if(decal){ if(decal){
MenuComponent::DrawDecal(game,parentPos,focused); MenuComponent::DrawDecal(game,parentPos,focused);
if(icon!=nullptr){ if(icon!=nullptr){
game->DrawDecal(Menu::menus[parentMenu]->pos+parentPos+rect.middle()-icon->sprite->Size()/2,icon); vf2d iconScale=rect.size/24.f;
game->DrawDecal(Menu::menus[parentMenu]->pos+parentPos+rect.middle()-icon->sprite->Size()*iconScale/2,icon,iconScale);
} }
} }
} }

@ -154,10 +154,11 @@ protected:
itemQuantity=invRef.at(inventoryIndex).Amt(); //So the item quantity comes from the stack itself and not our main inventory. itemQuantity=invRef.at(inventoryIndex).Amt(); //So the item quantity comes from the stack itself and not our main inventory.
} }
std::string quantityText="x"+std::to_string(itemQuantity); std::string quantityText="x"+std::to_string(itemQuantity);
vf2d textSize=vf2d(game->GetTextSizeProp(quantityText))*0.5; vf2d quantityTextScale=rect.size/48.f;
vf2d textSize=vf2d(game->GetTextSizeProp(quantityText))*quantityTextScale;
vf2d drawPos=parentPos+rect.pos+rect.size-textSize; vf2d drawPos=parentPos+rect.pos+rect.size-textSize;
if(PointWithinParent(this,drawPos)){ if(PointWithinParent(this,drawPos)){
game->DrawShadowStringDecal(drawPos,quantityText,WHITE,BLACK,{0.5,0.5},0.5); game->DrawShadowStringDecal(drawPos,quantityText,WHITE,BLACK,quantityTextScale,quantityTextScale.x);
} }
} }
} }

@ -97,14 +97,6 @@ protected:
onMouseOut(MenuFuncData{*Menu::menus[parentMenu],game,this,(ScrollableWindowComponent*)(parentComponent)}); onMouseOut(MenuFuncData{*Menu::menus[parentMenu],game,this,(ScrollableWindowComponent*)(parentComponent)});
} }
} }
virtual inline void AfterCreate()override{
if(itemNameLabelName!=""){
Component<MenuLabel>(parentMenu,itemNameLabelName)->Enable(false);
}
if(itemDescriptionLabelName!=""){
Component<MenuLabel>(parentMenu,itemDescriptionLabelName)->Enable(false);
}
}
virtual inline void Update(Crawler*game)override{ virtual inline void Update(Crawler*game)override{
MenuIconButton::Update(game); MenuIconButton::Update(game);
valid=!itemRef.get().IsBlank(); valid=!itemRef.get().IsBlank();
@ -146,10 +138,11 @@ protected:
MenuIconButton::DrawDecal(game,parentPos,focused); MenuIconButton::DrawDecal(game,parentPos,focused);
if(valid&&!hideQty){ if(valid&&!hideQty){
std::string quantityText="x"+std::to_string(itemRef.get().Amt()); std::string quantityText="x"+std::to_string(itemRef.get().Amt());
vf2d textSize=vf2d(game->GetTextSizeProp(quantityText))*0.5; vf2d quantityTextScale=rect.size/48.f;
vf2d textSize=vf2d(game->GetTextSizeProp(quantityText))*quantityTextScale;
vf2d drawPos=Menu::menus[parentMenu]->pos+parentPos+rect.pos+rect.size-textSize; vf2d drawPos=Menu::menus[parentMenu]->pos+parentPos+rect.pos+rect.size-textSize;
if(PointWithinParent(this,drawPos)){ if(PointWithinParent(this,drawPos)){
game->DrawShadowStringDecal(drawPos,quantityText,WHITE,BLACK,{0.5,0.5},0.5); game->DrawShadowStringDecal(drawPos,quantityText,WHITE,BLACK,quantityTextScale,quantityTextScale.x);
} }
} }
} }

@ -247,7 +247,7 @@ void Player::Update(float fElapsedTime){
notificationDisplay.second=std::max(0.f,notificationDisplay.second-fElapsedTime); notificationDisplay.second=std::max(0.f,notificationDisplay.second-fElapsedTime);
lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime); lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime);
blockTimer=std::max(0.f,blockTimer-fElapsedTime); blockTimer=std::max(0.f,blockTimer-fElapsedTime);
lastCombatTime=lastCombatTime+fElapsedTime; lastCombatTime=lastCombatTime+fElapsedTime;\
manaTickTimer-=fElapsedTime; manaTickTimer-=fElapsedTime;
CheckEndZoneCollision(); CheckEndZoneCollision();

@ -83,6 +83,7 @@ struct Player{
friend struct Witch; friend struct Witch;
friend class State_GameRun; friend class State_GameRun;
friend class Inventory; friend class Inventory;
friend void ItemOverlay::Draw();
private: private:
int hp="Warrior.BaseHealth"_I; int hp="Warrior.BaseHealth"_I;
int mana="Player.BaseMana"_I,maxmana=mana; int mana="Player.BaseMana"_I,maxmana=mana;

@ -65,7 +65,7 @@ void Monster::STRATEGY::TURRET(Monster&m,float fElapsedTime,int strategyNumber){
} }
auto dist=geom2d::line(m.GetPos(),game->GetPlayer()->GetPos()).length(); auto dist=geom2d::line(m.GetPos(),game->GetPlayer()->GetPos()).length();
if(dist<ConfigInt("Range")/100.f*24){ if(dist<ConfigInt("Range")/100.f*24&&game->GetPlayer()->OnUpperLevel()==m.OnUpperLevel()){
if(m.attackCooldownTimer==0){ if(m.attackCooldownTimer==0){
m.attackCooldownTimer=ConfigFloat("ShootingSpeed"); m.attackCooldownTimer=ConfigFloat("ShootingSpeed");
m.queueShotTimer=std::min(m.attackCooldownTimer-0.001f,0.3f); m.queueShotTimer=std::min(m.attackCooldownTimer-0.001f,0.3f);

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 1 #define VERSION_PATCH 1
#define VERSION_BUILD 3809 #define VERSION_BUILD 3827
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

Loading…
Cancel
Save