Search in sources :

Example 1 with MatHaxGuiTheme

use of mathax.client.gui.themes.mathax.MatHaxGuiTheme in project Client by MatHax.

the class WMatHaxHorizontalSeparator method renderWithoutText.

private void renderWithoutText(GuiRenderer renderer) {
    MatHaxGuiTheme theme = theme();
    double s = theme.scale(1);
    double w = width / 2;
    renderer.quad(x, y + s, w, s, theme.separatorEdges.get(), theme.separatorCenter.get());
    renderer.quad(x + w, y + s, w, s, theme.separatorCenter.get(), theme.separatorEdges.get());
}
Also used : MatHaxGuiTheme(mathax.client.gui.themes.mathax.MatHaxGuiTheme)

Example 2 with MatHaxGuiTheme

use of mathax.client.gui.themes.mathax.MatHaxGuiTheme in project Client by MatHax.

the class WMatHaxHorizontalSeparator method renderWithText.

private void renderWithText(GuiRenderer renderer) {
    MatHaxGuiTheme theme = theme();
    double s = theme.scale(2);
    double h = theme.scale(1);
    double textStart = Math.round(width / 2.0 - textWidth / 2.0 - s);
    double textEnd = s + textStart + textWidth + s;
    double offsetY = Math.round(height / 2.0);
    renderer.quad(x, y + offsetY, textStart, h, theme.separatorEdges.get(), theme.separatorCenter.get());
    renderer.text(text, x + textStart + s, y, theme.separatorText.get(), false);
    renderer.quad(x + textEnd, y + offsetY, width - textEnd, h, theme.separatorCenter.get(), theme.separatorEdges.get());
}
Also used : MatHaxGuiTheme(mathax.client.gui.themes.mathax.MatHaxGuiTheme)

Example 3 with MatHaxGuiTheme

use of mathax.client.gui.themes.mathax.MatHaxGuiTheme in project Client by MatHax.

the class WMatHaxSlider method renderBar.

private void renderBar(GuiRenderer renderer, double valueWidth) {
    MatHaxGuiTheme theme = theme();
    double s = theme.scale(3);
    double handleSize = handleSize();
    double x = this.x + handleSize / 2;
    double y = this.y + height / 2 - s / 2;
    renderer.quad(x, y, valueWidth, s, theme.sliderLeft.get());
    renderer.quad(x + valueWidth, y, width - valueWidth - handleSize, s, theme.sliderRight.get());
}
Also used : MatHaxGuiTheme(mathax.client.gui.themes.mathax.MatHaxGuiTheme)

Example 4 with MatHaxGuiTheme

use of mathax.client.gui.themes.mathax.MatHaxGuiTheme in project Client by MatHax.

the class WMatHaxTextBox method onRender.

@Override
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
    if (cursorTimer >= 1) {
        cursorVisible = !cursorVisible;
        cursorTimer = 0;
    } else {
        cursorTimer += delta * 1.75;
    }
    renderBackground(renderer, this, false, false);
    MatHaxGuiTheme theme = theme();
    double pad = pad();
    double overflowWidth = getOverflowWidthForRender();
    renderer.scissorStart(x + pad, y + pad, width - pad * 2, height - pad * 2);
    // Text content
    if (!text.isEmpty()) {
        renderer.text(text, x + pad - overflowWidth, y + pad, theme.textColor.get(), false);
    }
    // Text highlighting
    if (focused && (cursor != selectionStart || cursor != selectionEnd)) {
        double selStart = x + pad + getTextWidth(selectionStart) - overflowWidth;
        double selEnd = x + pad + getTextWidth(selectionEnd) - overflowWidth;
        renderer.quad(selStart, y + pad, selEnd - selStart, theme.textHeight(), theme.textHighlightColor.get());
    }
    // Cursor
    animProgress += delta * 10 * (focused && cursorVisible ? 1 : -1);
    animProgress = Utils.clamp(animProgress, 0, 1);
    if ((focused && cursorVisible) || animProgress > 0) {
        renderer.setAlpha(animProgress);
        renderer.quad(x + pad + getTextWidth(cursor) - overflowWidth, y + pad, theme.scale(1), theme.textHeight(), theme.textColor.get());
        renderer.setAlpha(1);
    }
    renderer.scissorEnd();
}
Also used : MatHaxGuiTheme(mathax.client.gui.themes.mathax.MatHaxGuiTheme)

Example 5 with MatHaxGuiTheme

use of mathax.client.gui.themes.mathax.MatHaxGuiTheme in project Client by MatHax.

the class WMatHaxCheckbox method onRender.

@Override
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
    MatHaxGuiTheme theme = theme();
    animProgress += (checked ? 1 : -1) * delta * 14;
    animProgress = Utils.clamp(animProgress, 0, 1);
    renderBackground(renderer, this, pressed, mouseOver);
    if (animProgress > 0) {
        double cs = (width - theme.scale(2)) / 1.75 * animProgress;
        renderer.quadRounded(x + (width - cs) / 2, y + (height - cs) / 2, cs, cs, theme.checkboxColor.get(), theme.roundAmount());
    }
}
Also used : MatHaxGuiTheme(mathax.client.gui.themes.mathax.MatHaxGuiTheme)

Aggregations

MatHaxGuiTheme (mathax.client.gui.themes.mathax.MatHaxGuiTheme)12 MeteorGuiTheme (mathax.client.gui.themes.meteor.MeteorGuiTheme)1 Color (mathax.client.utils.render.color.Color)1