use of betterquesting.api2.client.gui.misc.IGuiRect in project BetterQuesting by Funwayguy.
the class PanelPlayerPortrait method drawPanel.
@Override
public void drawPanel(int mx, int my, float partialTick) {
IGuiRect bounds = this.getTransform();
GlStateManager.pushMatrix();
Minecraft mc = Minecraft.getMinecraft();
RenderUtils.startScissor(mc, new GuiRectangle(bounds));
GlStateManager.color(1F, 1F, 1F, 1F);
int scale = Math.min(bounds.getWidth(), bounds.getHeight());
/*double d0 = (Minecraft.getSystemTime()%5000L)/5000D;
double d1 = (Math.sin(Math.toRadians(d0 * 360D)) + 1D)/2D;
double d2 = (Math.cos(Math.toRadians(d0 * 360D)) + 1D)/2D;
d1 = d1 * 5D + 10D;
d2 = d2 * -10D;*/
RenderUtils.RenderEntity(bounds.getX() + bounds.getWidth() / 2, bounds.getY() + bounds.getHeight() / 2 + (int) (scale * 1.2F), scale, yawDriver.readValue(), pitchDriver.readValue(), player);
RenderUtils.endScissor(mc);
GlStateManager.popMatrix();
}
use of betterquesting.api2.client.gui.misc.IGuiRect in project BetterQuesting by Funwayguy.
the class CanvasTextured method drawPanel.
@Override
public void drawPanel(int mx, int my, float partialTick) {
IGuiRect bounds = this.getTransform();
GlStateManager.pushMatrix();
GlStateManager.color(1F, 1F, 1F, 1F);
bgTexture.drawTexture(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), 0F, partialTick);
GlStateManager.popMatrix();
super.drawPanel(mx, my, partialTick);
}
use of betterquesting.api2.client.gui.misc.IGuiRect in project BetterQuesting by Funwayguy.
the class PanelHBarFill method drawPanel.
@Override
public void drawPanel(int mx, int my, float partialTick) {
IGuiRect bounds = this.getTransform();
GlStateManager.pushMatrix();
GlStateManager.color(1F, 1F, 1F, 1F);
if (texBack != null) {
texBack.drawTexture(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), 0F, partialTick);
}
float f = MathHelper.clamp(fillDriver.readValue(), 0F, 1F);
Minecraft mc = Minecraft.getMinecraft();
if (this.flipBar) {
RenderUtils.startScissor(mc, new GuiRectangle(bounds.getX() + (int) (bounds.getWidth() - (bounds.getWidth() * f)), bounds.getY(), (int) (bounds.getWidth() * f), bounds.getHeight(), 0));
} else {
RenderUtils.startScissor(mc, new GuiRectangle(bounds.getX(), bounds.getY(), (int) (bounds.getWidth() * f), bounds.getHeight(), 0));
}
if (this.clrThreshold > 0 && f < this.clrThreshold) {
int tmpC = this.clrLow;
if (lerpClr) {
tmpC = RenderUtils.lerpRGB(clrLow, clrNorm, f / clrThreshold);
}
int a1 = (tmpC >> 24) & 255;
int r1 = (tmpC >> 16) & 255;
int g1 = (tmpC >> 8) & 255;
int b1 = tmpC & 255;
GlStateManager.color(r1 / 255F, g1 / 255F, b1 / 255F, a1 / 255F);
} else {
int a1 = this.clrNorm >> 24 & 255;
int r1 = this.clrNorm >> 16 & 255;
int g1 = this.clrNorm >> 8 & 255;
int b1 = this.clrNorm & 255;
GlStateManager.color(r1 / 255F, g1 / 255F, b1 / 255F, a1 / 255F);
}
if (texFill != null) {
texFill.drawTexture(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), 0F, partialTick);
}
RenderUtils.endScissor(mc);
GlStateManager.popMatrix();
}
use of betterquesting.api2.client.gui.misc.IGuiRect in project BetterQuesting by Funwayguy.
the class PanelHScrollBar method onMouseScroll.
@Override
public boolean onMouseScroll(int mx, int my, int sdx) {
IGuiRect bounds = this.getTransform();
if (sdx == 0 || !bounds.contains(mx, my)) {
return false;
}
float dx = sdx * speed;
if ((dx < 0 && scroll <= 0F) || (dx > 0 && scroll >= 1)) {
return false;
} else {
this.writeValue(dx + scroll);
return true;
}
}
use of betterquesting.api2.client.gui.misc.IGuiRect in project BetterQuesting by Funwayguy.
the class PanelHScrollBar method drawPanel.
@Override
public void drawPanel(int mx, int my, float partialTick) {
IGuiRect bounds = this.getTransform();
if (isDragging && (Mouse.isButtonDown(0) || Mouse.isButtonDown(2))) {
float cx = (float) (mx - (bounds.getX() + hSize / 2)) / (float) (bounds.getWidth() - hSize);
this.writeValue(cx);
} else if (isDragging) {
this.isDragging = false;
}
GlStateManager.pushMatrix();
GlStateManager.color(1F, 1F, 1F, 1F);
if (texBack != null) {
texBack.drawTexture(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), 0F, partialTick);
}
int sx = MathHelper.floor((bounds.getWidth() - hSize - (inset * 2)) * scroll);
if (texHndlHover != null && (isDragging || bounds.contains(mx, my))) {
texHndlHover.drawTexture(bounds.getX() + sx + inset, bounds.getY() + inset, hSize, bounds.getHeight() - (inset * 2), 0F, partialTick);
} else if (texHndlIdle != null) {
texHndlIdle.drawTexture(bounds.getX() + sx + inset, bounds.getY() + inset, hSize, bounds.getHeight() - (inset * 2), 0F, partialTick);
}
GlStateManager.popMatrix();
}
Aggregations