feat: C++ HUD Rendering
This commit is contained in:
1 parent
c2e1541cdf
commit
9e4426b0d8
2 files changed
+15
-80
No files matched your search
+15
-75
@@ -29,10 +29,10 @@
|
||||
#include "..\Minecraft.World\Biome.h"
|
||||
|
||||
#define RENDER_HUD 0
|
||||
//#ifndef _XBOX
|
||||
//#undef RENDER_HUD
|
||||
//#define RENDER_HUD 1
|
||||
//#endif
|
||||
#ifndef _XBOX
|
||||
#undef RENDER_HUD
|
||||
#define RENDER_HUD 1
|
||||
#endif
|
||||
|
||||
float Gui::currentGuiBlendFactor = 1.0f; // 4J added
|
||||
float Gui::currentGuiScaleFactor = 1.0f; // 4J added
|
||||
@@ -293,6 +293,9 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
|
||||
blitOffset = -90;
|
||||
|
||||
//str1k3r - make the hotbar transparent
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// Display the quick select background, the quick select selection, and the crosshair
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -353,11 +356,6 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
int iLastHealth = minecraft->player->lastHealth;
|
||||
random->setSeed(tickCount * 312871);
|
||||
|
||||
bool foodBlink = false;
|
||||
FoodData *foodData = minecraft->player->getFoodData();
|
||||
int food = foodData->getFoodLevel();
|
||||
int oldFood = foodData->getLastFoodLevel();
|
||||
|
||||
// if (false) //(true)
|
||||
// {
|
||||
// renderBossHealth();
|
||||
@@ -387,37 +385,15 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
xRight = (screenWidth + quickSelectWidth) / 2;
|
||||
}
|
||||
|
||||
// render experience bar
|
||||
int xpNeededForNextLevel = minecraft->player->getXpNeededForNextLevel();
|
||||
if (xpNeededForNextLevel > 0)
|
||||
{
|
||||
int w = 182;
|
||||
|
||||
int progress = (int) (minecraft->player->experienceProgress * (float) (w + 1));
|
||||
|
||||
int yo = screenHeight - iSafezoneYHalf - iTooltipsYOffset - 8;
|
||||
if(bTwoPlayerSplitscreen)
|
||||
{
|
||||
yo+=iHeightOffset;
|
||||
}
|
||||
blit(xLeft, yo, 0, 64, w, 5);
|
||||
if (progress > 0)
|
||||
{
|
||||
blit(xLeft, yo, 0, 69, progress, 5);
|
||||
}
|
||||
}
|
||||
|
||||
int yLine1, yLine2;
|
||||
if(bTwoPlayerSplitscreen)
|
||||
{
|
||||
//yo = iHeightOffset + screenHeight - 10 - iSafezoneYHalf - iTooltipsYOffset;
|
||||
yLine1 = iHeightOffset + screenHeight - 18 - iSafezoneYHalf - iTooltipsYOffset;
|
||||
yLine1 = iHeightOffset + screenHeight - 10 - iSafezoneYHalf - iTooltipsYOffset;
|
||||
yLine2 = yLine1 - 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
//yo = screenHeight - 10 - iSafezoneYHalf - iTooltipsYOffset;
|
||||
yLine1 = screenHeight - 18 - iSafezoneYHalf - iTooltipsYOffset;
|
||||
yLine1 = screenHeight - 10 - iSafezoneYHalf - iTooltipsYOffset;
|
||||
yLine2 = yLine1 - 10;
|
||||
}
|
||||
|
||||
@@ -433,12 +409,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
{
|
||||
if (armor > 0)
|
||||
{
|
||||
int xo = xLeft + i * 8;
|
||||
|
||||
// HEALTH
|
||||
if (i * 2 + 1 < armor) blit(xo, yLine2, 16 + 2 * 9, 9 * 1, 9, 9);
|
||||
if (i * 2 + 1 == armor) blit(xo, yLine2, 16 + 1 * 9, 9 * 1, 9, 9);
|
||||
if (i * 2 + 1 > armor) blit(xo, yLine2, 16 + 0 * 9, 9 * 1, 9, 9);
|
||||
// ARMOUR, shrug this is the only british word that looks better
|
||||
if (i * 2 + 1 < armor) blit(xRight - i * 8 - 9, yLine1, 16 + 2 * 9, 9 * 1, 9, 9);
|
||||
if (i * 2 + 1 == armor) blit(xRight - i * 8 - 9, yLine1, 16 + 1 * 9, 9 * 1, 9, 9);
|
||||
if (i * 2 + 1 > armor) blit(xRight - i * 8 - 9, yLine1, 16 + 0 * 9, 9 * 1, 9, 9);
|
||||
}
|
||||
|
||||
int healthTexBaseX = 16;
|
||||
@@ -476,40 +450,6 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
if (i * 2 + 1 == iHealth) blit(xo, yo, healthTexBaseX + 5 * 9, 9 * y0, 9, 9);
|
||||
}
|
||||
|
||||
// render food
|
||||
for (int i = 0; i < FoodConstants::MAX_FOOD / 2; i++)
|
||||
{
|
||||
int yo = yLine1;
|
||||
|
||||
|
||||
int texBaseX = 16;
|
||||
int bg = 0;
|
||||
if (minecraft->player->hasEffect(MobEffect::hunger))
|
||||
{
|
||||
texBaseX += 4 * 9;
|
||||
bg = 13;
|
||||
}
|
||||
|
||||
if (minecraft->player->getFoodData()->getSaturationLevel() <= 0)
|
||||
{
|
||||
if ((tickCount % (food * 3 + 1)) == 0)
|
||||
{
|
||||
yo += random->nextInt(3) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (foodBlink) bg = 1;
|
||||
int xo = xRight - i * 8 - 9;
|
||||
blit(xo, yo, 16 + bg * 9, 9 * 3, 9, 9);
|
||||
if (foodBlink)
|
||||
{
|
||||
if (i * 2 + 1 < oldFood) blit(xo, yo, texBaseX + 6 * 9, 9 * 3, 9, 9);
|
||||
if (i * 2 + 1 == oldFood) blit(xo, yo, texBaseX + 7 * 9, 9 * 3, 9, 9);
|
||||
}
|
||||
if (i * 2 + 1 < food) blit(xo, yo, texBaseX + 4 * 9, 9 * 3, 9, 9);
|
||||
if (i * 2 + 1 == food) blit(xo, yo, texBaseX + 5 * 9, 9 * 3, 9, 9);
|
||||
}
|
||||
|
||||
// render air bubbles
|
||||
if (minecraft->player->isUnderLiquid(Material::water))
|
||||
{
|
||||
@@ -518,8 +458,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
for (int i = 0; i < count + extra; i++)
|
||||
{
|
||||
// Air bubbles
|
||||
if (i < count) blit(xRight - i * 8 - 9, yLine2, 16, 9 * 2, 9, 9);
|
||||
else blit(xRight - i * 8 - 9, yLine2, 16 + 9, 9 * 2, 9, 9);
|
||||
if (i < count) blit(xLeft + i * 8, yLine2, 16, 9 * 2, 9, 9);
|
||||
else blit(xLeft + i * 8, yLine2, 16 + 9, 9 * 2, 9, 9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user