Prepare framework with Draw and DrawDecal split.

This commit is contained in:
2023-10-11 19:50:12 -05:00
parent dd2ff24d85
commit e3d0283fcb
16 changed files with 479 additions and 46 deletions
+4 -3
View File
@@ -4,6 +4,7 @@
#include "Crawler.h"
#include "Item.h"
#include "safemap.h"
#include "olcPGEX_Graphics2D.h"
INCLUDE_game
INCLUDE_ITEM_DATA
@@ -57,12 +58,12 @@ protected:
}
}
}
virtual inline void Draw(Crawler*game,vf2d parentPos,bool focused)override{
MenuIconButton::Draw(game,parentPos,focused);
virtual inline void DrawDecal(Crawler*game,vf2d parentPos,bool focused)override{
MenuIconButton::DrawDecal(game,parentPos,focused);
if(valid){
std::string quantityText="x"+std::to_string(Inventory::GetItemCount(invRef.at(inventoryIndex)));
vf2d textSize=vf2d(game->GetTextSizeProp(quantityText))*0.5;
game->DrawShadowStringDecal(parentPos+rect.pos+rect.size-textSize,quantityText,WHITE,BLACK,{0.5,0.5},0.5);
game->DrawShadowStringDecal(Menu::menus[parentMenu]->pos+parentPos+rect.pos+rect.size-textSize,quantityText,WHITE,BLACK,{0.5,0.5},0.5);
}
}
virtual inline MenuComponent*PickUpDraggableItem()override{