* Improve survival mode stuff.

This commit is contained in:
iProgramInCpp
2023-08-04 11:18:28 +03:00
parent 1921552b18
commit 1386b3d658
20 changed files with 458 additions and 88 deletions

View File

@@ -6,6 +6,7 @@
SPDX-License-Identifier: BSD-1-Clause
********************************************************************/
#include <sstream>
#include "ItemRenderer.hpp"
#include "TileRenderer.hpp"
#include "ItemEntity.hpp"
@@ -157,6 +158,23 @@ void ItemRenderer::blit(int dx, int dy, int sx, int sy, int tw, int th)
t.draw();
}
void ItemRenderer::renderGuiItemOverlay(Font* font, Textures* textures, ItemInstance* instance, int x, int y)
{
if (!instance)
return;
if (instance->m_amount == 1)
return;
std::stringstream ss;
ss << instance->m_amount;
std::string amtstr = ss.str();
int width = font->width(amtstr), height = font->height(amtstr) + 8;
font->drawShadow(amtstr, x + 17 - width, y + 17 - height, 0xFFFFFF);
}
void ItemRenderer::renderGuiItem(Font* font, Textures* textures, ItemInstance* instance, int x, int y, bool b)
{
// @NOTE: Font unused but would presumably be used to draw the item amount.