mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-26 02:27:30 +00:00
feat(jui): add beacon screen
This commit is contained in:
46
Minecraft.Client/UI/AbstractBeaconButton.cpp
Normal file
46
Minecraft.Client/UI/AbstractBeaconButton.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "../../Platform/stdafx.h"
|
||||
#include "AbstractBeaconButton.h"
|
||||
#include "../Textures/Textures.h"
|
||||
#include "../../../Minecraft.Client/Minecraft.h"
|
||||
#include <GL/gl.h>
|
||||
|
||||
// 4jcraft: referenced from MCP 8.11 (JE 1.6.4)
|
||||
#ifdef ENABLE_JAVA_GUIS
|
||||
extern ResourceLocation GUI_BEACON_LOCATION;
|
||||
#endif
|
||||
|
||||
AbstractBeaconButton::AbstractBeaconButton(int id, int x, int y)
|
||||
: Button(id, x, y, 22, 22, L"") {
|
||||
hovered = false;
|
||||
selected = false;
|
||||
iconRes = nullptr;
|
||||
iconU = iconV = 0;
|
||||
}
|
||||
|
||||
void AbstractBeaconButton::renderBg(Minecraft* minecraft, int xm, int ym) {
|
||||
#ifdef ENABLE_JAVA_GUIS
|
||||
if (!visible) return;
|
||||
|
||||
hovered = (xm >= x && ym >= y && xm < x + w && ym < y + h);
|
||||
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
minecraft->textures->bindTexture(&GUI_BEACON_LOCATION);
|
||||
|
||||
int texU = 0;
|
||||
if (!active) {
|
||||
texU += w * 2;
|
||||
} else if (selected) {
|
||||
texU += w * 1;
|
||||
} else if (hovered) {
|
||||
texU += w * 3;
|
||||
}
|
||||
int texV = 219;
|
||||
|
||||
blit(x, y, texU, texV, w, h);
|
||||
|
||||
if (iconRes != nullptr && iconRes != &GUI_BEACON_LOCATION) {
|
||||
minecraft->textures->bindTexture(iconRes);
|
||||
}
|
||||
blit(x + 2, y + 2, iconU, iconV, 18, 18);
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user