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.
This commit is contained in:
parent
e4c777f60a
commit
c11417d8a0
@ -1268,6 +1268,13 @@ void Crawler::RenderCooldowns(){
|
||||
Decal*overlayIcon=GFX["skill_overlay_icon.png"].Decal();
|
||||
if(!circle)overlayIcon=GFX["square_skill_overlay_icon.png"].Decal();
|
||||
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;
|
||||
if(player->GetMana()<a.manaCost){
|
||||
@ -2024,10 +2031,12 @@ void Crawler::InitializeGraphics(){
|
||||
squareCircleCooldownPoints.push_back({0,0});
|
||||
for(int i=0;i<=360;i+=4){
|
||||
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)});
|
||||
vf2d point=vf2d{cos(angle),sin(angle)}*sqrt(2.1f);
|
||||
point.x=std::clamp(point.x,-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);
|
||||
}
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ All rights reserved.
|
||||
#include "DEFINES.h"
|
||||
#include "Crawler.h"
|
||||
#include "Menu.h"
|
||||
#include "Ability.h"
|
||||
|
||||
INCLUDE_game
|
||||
INCLUDE_DATA
|
||||
|
||||
@ -63,7 +63,8 @@ protected:
|
||||
if(!decal){
|
||||
MenuComponent::Draw(game,parentPos);
|
||||
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){
|
||||
MenuComponent::DrawDecal(game,parentPos,focused);
|
||||
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.
|
||||
}
|
||||
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;
|
||||
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)});
|
||||
}
|
||||
}
|
||||
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{
|
||||
MenuIconButton::Update(game);
|
||||
valid=!itemRef.get().IsBlank();
|
||||
@ -146,10 +138,11 @@ protected:
|
||||
MenuIconButton::DrawDecal(game,parentPos,focused);
|
||||
if(valid&&!hideQty){
|
||||
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;
|
||||
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);
|
||||
lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime);
|
||||
blockTimer=std::max(0.f,blockTimer-fElapsedTime);
|
||||
lastCombatTime=lastCombatTime+fElapsedTime;
|
||||
lastCombatTime=lastCombatTime+fElapsedTime;\
|
||||
manaTickTimer-=fElapsedTime;
|
||||
|
||||
CheckEndZoneCollision();
|
||||
|
||||
@ -83,6 +83,7 @@ struct Player{
|
||||
friend struct Witch;
|
||||
friend class State_GameRun;
|
||||
friend class Inventory;
|
||||
friend void ItemOverlay::Draw();
|
||||
private:
|
||||
int hp="Warrior.BaseHealth"_I;
|
||||
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();
|
||||
if(dist<ConfigInt("Range")/100.f*24){
|
||||
if(dist<ConfigInt("Range")/100.f*24&&game->GetPlayer()->OnUpperLevel()==m.OnUpperLevel()){
|
||||
if(m.attackCooldownTimer==0){
|
||||
m.attackCooldownTimer=ConfigFloat("ShootingSpeed");
|
||||
m.queueShotTimer=std::min(m.attackCooldownTimer-0.001f,0.3f);
|
||||
|
||||
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 1
|
||||
#define VERSION_BUILD 3809
|
||||
#define VERSION_BUILD 3827
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user