mirror of
https://github.com/GTNewHorizons/waila.git
synced 2026-11-21 20:52:40 +00:00
Generic icon rendering method based on an enum with u,v,su,sv
Also handles adding a backgroup icon (for hearts for example).
This commit is contained in:
1 parent
904fe472b8
commit
5f7bf6cc5c
3 files changed
+37
-10
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package mcp.mobius.waila.overlay;
|
||||
|
||||
public enum IconUI {
|
||||
HEART(52, 0, 9, 9, 52, 9, 9, 9),
|
||||
HHEART(61, 0, 9, 9, 52, 9, 9, 9);
|
||||
|
||||
public final int u, v, su, sv;
|
||||
public final int bu, bv, bsu, bsv;
|
||||
private IconUI(int u, int v, int su, int sv){
|
||||
this.u = u;
|
||||
this.v = v;
|
||||
this.su = su;
|
||||
this.sv = sv;
|
||||
this.bu = -1;
|
||||
this.bv = -1;
|
||||
this.bsu = -1;
|
||||
this.bsv = -1;
|
||||
}
|
||||
|
||||
private IconUI(int u, int v, int su, int sv, int bu, int bv, int bsu, int bsv){
|
||||
this.u = u;
|
||||
this.v = v;
|
||||
this.su = su;
|
||||
this.sv = sv;
|
||||
this.bu = bu;
|
||||
this.bv = bv;
|
||||
this.bsu = bsu;
|
||||
this.bsv = bsv;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -137,16 +137,10 @@ public class OverlayRenderer {
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public static void renderHeart(int x, int y, int sx, int sy){
|
||||
public static void renderIcon(int x, int y, int sx, int sy, IconUI icon){
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(Gui.icons);
|
||||
drawTexturedModalRect(x, y, 52, 9, sx, sy, 9, 9);
|
||||
drawTexturedModalRect(x, y, 52, 0, sx, sy, 9, 9);
|
||||
if (icon.bu != -1)
|
||||
drawTexturedModalRect(x, y, icon.bu, icon.bv, sx, sy, icon.bsu, icon.bsv);
|
||||
drawTexturedModalRect(x, y, icon.u, icon.v, sx, sy, icon.su, icon.sv);
|
||||
}
|
||||
|
||||
public static void renderHalfHeart(int x, int y, int sx, int sy){
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(Gui.icons);
|
||||
drawTexturedModalRect(x, y, 52, 9, sx, sy, 9, 9);
|
||||
drawTexturedModalRect(x, y, 61, 0, sx, sy, 9, 9);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,5 +99,7 @@ public class Tooltip {
|
||||
for (int c = 0; c < lines.get(i).ncolumns; c++)
|
||||
drawString(lines.get(i).columns[c], x + offsetX + columnsPos[c] + c*TabSpacing, y + ty + 10*i, OverlayConfig.fontcolor, true);
|
||||
}
|
||||
|
||||
//OverlayRenderer.renderIcon(0, 0, 16, 16, IconUI.HEART);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user