Improve MC Healthbar and add menu entries

This commit is contained in:
bencat07 2019-05-25 17:03:38 +02:00
parent 51911fc013
commit 97dea19521
2 changed files with 7 additions and 4 deletions

View File

@ -20,6 +20,8 @@
<AutoVariable width="fill" target="visual.snowflakes.sideways-speed.max" label="Maximum sidemove speed"/>
<AutoVariable width="fill" target="visual.font_size.esp" label="Main font size"/>
<AutoVariable width="fill" target="visual.font_size.center_size" label="Center string font size"/>
<AutoVariable width="fill" target="mc_health.enable" label="Enable MC Healthbar"/>
<AutoVariable width="fill" target="mc_health.size" label="MC Healthbar size"/>
</List>
</Box>
</Tab>

View File

@ -9,8 +9,9 @@
namespace mchealthbar
{
// qtcreator marks no extern declared but there is, so don't make it static thanks
settings::Bool minecraftHP("mc_health.enable", "false");
static settings::Float size("mc_health.size", "64");
static settings::Float size("mc_health.size", "32");
static std::vector<textures::sprite> absorption;
static std::vector<textures::sprite> hearts;
@ -26,8 +27,8 @@ void draw_func()
if (!minecraftHP || CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return;
float iconSize = *size;
float startPosX = draw::width / 2 - iconSize * 5.0f;
float startPosY = draw::height - iconSize;
float startPosX = draw::width * 0.2f - iconSize * 5.0f;
float startPosY = draw::height - iconSize - 1.0f;
float halfHeart = LOCAL_E->m_iMaxHealth() / 20; // HP per half heart
float halfHearts = LOCAL_E->m_iHealth() / halfHeart; // health in half hearts