use of org.joml.Vector4f in project chunkstories-api by Hugobros3.
the class BaseButton method render.
@Override
public void render(RenderingInterface renderer) {
float width = getWidth();
String localizedText = layer.getGameWindow().getClient().getContent().localization().localize(text);
Texture2D buttonTexture = renderer.textures().getTexture("./textures/gui/scalableButton2.png");
if (isFocused() || isMouseOver())
buttonTexture = renderer.textures().getTexture("./textures/gui/scalableButtonOver2.png");
buttonTexture.setLinearFiltering(false);
renderer.getGuiRenderer().drawCorneredBoxTiled(xPosition, yPosition, width, getHeight(), 4 * scale(), buttonTexture, 32, scale());
// new Vector4f(76/255f, 76/255f, 76/255f, 1));
renderer.getFontRenderer().drawString(font, xPosition + 4 * scale(), yPosition, localizedText, fontScaler * scale(), new Vector4f(0, 0, 0, 1));
}
use of org.joml.Vector4f in project chunkstories-api by Hugobros3.
the class InputText method render.
@Override
public void render(RenderingInterface renderer) {
String text = this.text;
if (password) {
String passworded = "";
for (@SuppressWarnings("unused") char c : text.toCharArray()) passworded += "*";
text = passworded;
}
Texture2D backgroundTexture = renderer.textures().getTexture(isFocused() ? "./textures/gui/textbox.png" : "./textures/gui/textboxnofocus.png");
if (this.isTransparent)
backgroundTexture = renderer.textures().getTexture(isFocused() ? "./textures/gui/textboxnofocustransp.png" : "./textures/gui/textboxtransp.png");
backgroundTexture.setLinearFiltering(false);
renderer.getGuiRenderer().drawCorneredBoxTiled(xPosition - 0 * scale(), yPosition - 0 * scale(), getWidth() + 0 * scale(), getHeight() + 0 * scale(), 4, backgroundTexture, 32, scale());
renderer.getFontRenderer().drawStringWithShadow(ttfFont, xPosition + 4 * scale(), yPosition + 1 * scale(), text + ((isFocused() && System.currentTimeMillis() % 1000 > 500) ? "|" : ""), scale(), scale(), new Vector4f(1.0f));
}
use of org.joml.Vector4f in project chunkstories-api by Hugobros3.
the class LargeButtonIcon method render.
@Override
public void render(RenderingInterface renderer) {
String localizedText = layer.getGameWindow().getClient().getContent().localization().localize(text);
Texture2D buttonTexture = renderer.textures().getTexture("./textures/gui/mainMenu.png");
if (isFocused() || isMouseOver())
buttonTexture = renderer.textures().getTexture("./textures/gui/mainMenuOver.png");
buttonTexture.setLinearFiltering(false);
renderer.getGuiRenderer().drawCorneredBoxTiled(xPosition, yPosition, getWidth(), getHeight(), 4 * scale(), buttonTexture, 32, scale());
Font font = layer.getGameWindow().getFontRenderer().getFont("LiberationSansNarrow-Bold__aa", 32f);
float a = 0.5f;
// a = 1;
float yPositionText = yPosition + 26 * scale();
float centering = getWidth() / 2 - font.getWidth(localizedText) * a * scale() / 2;
renderer.getFontRenderer().drawString(font, xPosition + centering + scale(), yPositionText - scale(), localizedText, a * scale(), new Vector4f(161 / 255f, 161 / 255f, 161 / 255f, 1));
renderer.getFontRenderer().drawString(font, xPosition + centering, yPositionText, localizedText, a * scale(), new Vector4f(38 / 255f, 38 / 255f, 38 / 255f, 1));
renderer.textures().getTexture("./textures/gui/icons/" + iconName + ".png").setLinearFiltering(false);
renderer.getGuiRenderer().drawBoxWindowsSpaceWithSize(xPosition + getWidth() / 2 - 16 * scale(), yPosition + getHeight() / 2 - 26 * scale(), 32 * scale(), 32 * scale(), 0, 1, 1, 0, renderer.textures().getTexture("./textures/gui/icons/" + iconName + ".png"), false, true, null);
}
use of org.joml.Vector4f in project chunkstories by Hugobros3.
the class KeyBindSelectionOverlay method render.
@Override
public void render(RenderingInterface renderer) {
this.parentLayer.render(renderer);
renderer.getGuiRenderer().drawBoxWindowsSpace(0, 0, renderer.getWindow().getWidth(), renderer.getWindow().getHeight(), 0, 0, 0, 0, null, false, true, new Vector4f(0.0f, 0.0f, 0.0f, 0.5f));
String plz = "Please press a key";
Font font = renderer.getFontRenderer().getFont("LiberationSans-Regular", 11);
renderer.getFontRenderer().drawStringWithShadow(font, renderer.getWindow().getWidth() / 2 - font.getWidth(plz) * 1.5f, renderer.getWindow().getHeight() / 2, plz, 3, 3, new Vector4f(1));
}
use of org.joml.Vector4f in project chunkstories by Hugobros3.
the class OptionsScreen method render.
@Override
public void render(RenderingInterface renderer) {
// this.renderer = renderer;
parentLayer.getRootLayer().render(renderer);
int optionsPanelSize = (160 * 2 + 16 + 32) * this.getGuiScale();
// Shades the BG
renderer.getGuiRenderer().drawBoxWindowsSpace(0, 0, renderer.getWindow().getWidth(), renderer.getWindow().getHeight(), 0, 0, 0, 0, null, false, true, new Vector4f(0.0f, 0.0f, 0.0f, 0.5f));
renderer.getGuiRenderer().drawBoxWindowsSpace(renderer.getWindow().getWidth() / 2.0f - optionsPanelSize / 2, 0, renderer.getWindow().getWidth() / 2 + optionsPanelSize / 2, renderer.getWindow().getHeight(), 0, 0, 0, 0, null, false, true, new Vector4f(0.0f, 0.0f, 0.0f, 0.5f));
// Render the tabs buttons
float dekal = 16 * this.getGuiScale();
for (TabButton b : tabsButtons) {
b.setPosition(renderer.getWindow().getWidth() / 2 - optionsPanelSize / 2 + dekal, renderer.getWindow().getHeight() - 64 * this.getGuiScale());
b.render(renderer);
dekal += b.getWidth() / 2f;
dekal += b.getWidth() / 2f;
}
// Display the current tab
ConfigTab currentConfigTab = configTabs.get(selectedConfigTab);
int a = 0, b = 0;
int startPosX = renderer.getWindow().getWidth() / 2 - optionsPanelSize / 2 + 0 + 16 * this.getGuiScale();
int startPosY = renderer.getWindow().getHeight() - (64 + 32) * this.getGuiScale();
Mouse mouse = gameWindow.getInputsManager().getMouse();
for (ConfigButton c : currentConfigTab.configButtons) {
c.setPosition(startPosX + b * (160 + 16) * this.getGuiScale(), startPosY - (float) Math.floor(a / 2) * 32 * this.getGuiScale());
c.updateText();
c.render(renderer);
// Scale buttons work a bit hackyshly
if (c instanceof ConfigButtonScale && c.isMouseOver() && mouse.getMainButton().isPressed()) {
ConfigButtonScale cs = (ConfigButtonScale) c;
cs.onClick((float) mouse.getCursorX(), (float) mouse.getCursorY(), 0);
cs.apply();
}
a++;
b = a % 2;
}
renderer.getFontRenderer().drawStringWithShadow(renderer.getFontRenderer().getFont("LiberationSans-Regular", 11), renderer.getWindow().getWidth() / 2 - optionsPanelSize / 2 + 16 * this.getGuiScale(), renderer.getWindow().getHeight() - 32 * this.getGuiScale(), Client.getInstance().getContent().localization().getLocalizedString("options.title"), 3, 3, new Vector4f(1));
exitButton.setPosition(8, 8);
exitButton.render(renderer);
}
Aggregations