Search in sources :

Example 16 with IGuiRect

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();
}
Also used : IGuiRect(betterquesting.api2.client.gui.misc.IGuiRect) GuiRectangle(betterquesting.api2.client.gui.misc.GuiRectangle) Minecraft(net.minecraft.client.Minecraft)

Example 17 with IGuiRect

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);
}
Also used : IGuiRect(betterquesting.api2.client.gui.misc.IGuiRect)

Example 18 with IGuiRect

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();
}
Also used : IGuiRect(betterquesting.api2.client.gui.misc.IGuiRect) GuiRectangle(betterquesting.api2.client.gui.misc.GuiRectangle) Minecraft(net.minecraft.client.Minecraft)

Example 19 with IGuiRect

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;
    }
}
Also used : IGuiRect(betterquesting.api2.client.gui.misc.IGuiRect)

Example 20 with IGuiRect

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();
}
Also used : IGuiRect(betterquesting.api2.client.gui.misc.IGuiRect)

Aggregations

IGuiRect (betterquesting.api2.client.gui.misc.IGuiRect)15 GuiRectangle (betterquesting.api2.client.gui.misc.GuiRectangle)6 PanelButton (betterquesting.api2.client.gui.controls.PanelButton)4 CanvasTextured (betterquesting.api2.client.gui.panels.CanvasTextured)4 PanelVScrollBar (betterquesting.api2.client.gui.panels.bars.PanelVScrollBar)4 PanelLine (betterquesting.api2.client.gui.panels.content.PanelLine)4 CanvasScrolling (betterquesting.api2.client.gui.panels.lists.CanvasScrolling)4 IPanelButton (betterquesting.api2.client.gui.controls.IPanelButton)3 PanelButtonStorage (betterquesting.api2.client.gui.controls.PanelButtonStorage)3 PanelTextBox (betterquesting.api2.client.gui.panels.content.PanelTextBox)3 IGuiTexture (betterquesting.api2.client.gui.resources.textures.IGuiTexture)3 Minecraft (net.minecraft.client.Minecraft)3 FontRenderer (net.minecraft.client.gui.FontRenderer)3 Vector4f (org.lwjgl.util.vector.Vector4f)3 IQuest (betterquesting.api.questing.IQuest)2 CanvasEmpty (betterquesting.api2.client.gui.panels.CanvasEmpty)2 PanelGeneric (betterquesting.api2.client.gui.panels.content.PanelGeneric)2 IGuiColor (betterquesting.api2.client.gui.resources.colors.IGuiColor)2 IGuiLine (betterquesting.api2.client.gui.resources.lines.IGuiLine)2 GuiTextureColored (betterquesting.api2.client.gui.resources.textures.GuiTextureColored)2