Search in sources :

Example 11 with Font

use of io.xol.chunkstories.api.rendering.text.FontRenderer.Font in project chunkstories by Hugobros3.

the class ServerSelection method render.

@Override
public void render(RenderingInterface renderer) {
    parentLayer.getRootLayer().render(renderer);
    float scale = this.getGuiScale();
    if (autologin && !ipForm.getText().equals(""))
        login();
    String instructions = "Select a server from the list or type in the address directly";
    Font font = renderer.getFontRenderer().getFont("LiberationSans-Regular", 11);
    renderer.getFontRenderer().drawStringWithShadow(font, 32, renderer.getWindow().getHeight() - 32 * 2, instructions, 3, 3, new Vector4f(1));
    // gui
    float txtbox = renderer.getWindow().getWidth() - connectButton.getWidth() - 48 - 8 * scale;
    ipForm.setPosition(25, renderer.getWindow().getHeight() - 100);
    ipForm.setWidth(txtbox / this.getGuiScale());
    ipForm.render(renderer);
    connectButton.setPosition(ipForm.getPositionX() + ipForm.getWidth() + 4 * scale, renderer.getWindow().getHeight() - 100);
    connectButton.render(renderer);
    backOption.setPosition(8, 8);
    backOption.render(renderer);
    updateServers();
    int s = Client.getInstance().getGameWindow().getGuiScale();
    float offsetForButtons = backOption.getPositionY() + backOption.getHeight() + 8 * scale;
    float offsetForHeaderText = 32 * scale + ipForm.getHeight();
    serverSelectionZone.setPosition((width - 480 * scale) / 2, offsetForButtons);
    serverSelectionZone.setDimensions(480 * scale, height - (offsetForButtons + offsetForHeaderText));
    serverSelectionZone.render(renderer);
}
Also used : Vector4f(org.joml.Vector4f) Font(io.xol.chunkstories.api.rendering.text.FontRenderer.Font)

Example 12 with Font

use of io.xol.chunkstories.api.rendering.text.FontRenderer.Font in project chunkstories-api by Hugobros3.

the class LargeButton 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().getRenderingInterface().getFontRenderer().getFont("LiberationSansNarrow-Bold__aa", 16f * scale());
    float a = 1f / scale();
    float yPositionText = yPosition + 2.5f * 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));
}
Also used : Texture2D(io.xol.chunkstories.api.rendering.textures.Texture2D) Vector4f(org.joml.Vector4f) Font(io.xol.chunkstories.api.rendering.text.FontRenderer.Font)

Example 13 with Font

use of io.xol.chunkstories.api.rendering.text.FontRenderer.Font in project chunkstories-core by Hugobros3.

the class ItemFirearm method drawItemOverlay.

@Override
public void drawItemOverlay(RenderingInterface renderingInterface, ItemPile pile) {
    EntityLiving clientControlledEntity = (EntityLiving) renderingInterface.getClient().getPlayer().getControlledEntity();
    if (clientControlledEntity != null && pile.getInventory() != null && pile.getInventory().getHolder() != null && pile.getInventory().getHolder().equals(clientControlledEntity)) {
        if (isScoped())
            drawScope(renderingInterface);
        Vector3d eyeLocation = new Vector3d(clientControlledEntity.getLocation());
        if (clientControlledEntity instanceof EntityPlayer)
            eyeLocation.add(new Vector3d(0.0, ((EntityPlayer) clientControlledEntity).eyePosition, 0.0));
        Vector3d direction = new Vector3d(clientControlledEntity.getDirectionLookingAt());
        direction.add(new Vector3d(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize().mul(accuracy / 100d));
        direction.normalize();
        // display reload cooldownt text
        if (cooldownEnd > System.currentTimeMillis()) {
            String reloadText = "Reloading weapon, please wait";
            Font font = renderingInterface.getFontRenderer().defaultFont();
            // TrueTypeFont.arial11px.getWidth(reloadText);
            int cooldownLength = font.getWidth(reloadText);
            renderingInterface.getFontRenderer().drawString(font, -cooldownLength + renderingInterface.getWindow().getWidth() / 2, renderingInterface.getWindow().getHeight() / 2, reloadText, 2);
        }
    }
}
Also used : EntityLiving(io.xol.chunkstories.api.entity.EntityLiving) Vector3d(org.joml.Vector3d) EntityPlayer(io.xol.chunkstories.core.entity.EntityPlayer) Font(io.xol.chunkstories.api.rendering.text.FontRenderer.Font)

Aggregations

Font (io.xol.chunkstories.api.rendering.text.FontRenderer.Font)13 Vector4f (org.joml.Vector4f)12 EntityLiving (io.xol.chunkstories.api.entity.EntityLiving)2 Texture2D (io.xol.chunkstories.api.rendering.textures.Texture2D)2 Location (io.xol.chunkstories.api.Location)1 Entity (io.xol.chunkstories.api.entity.Entity)1 EntityControllable (io.xol.chunkstories.api.entity.interfaces.EntityControllable)1 Mouse (io.xol.chunkstories.api.input.Mouse)1 CameraInterface (io.xol.chunkstories.api.rendering.CameraInterface)1 ChunkRenderable (io.xol.chunkstories.api.rendering.world.chunk.ChunkRenderable)1 VoxelSide (io.xol.chunkstories.api.voxel.VoxelSide)1 CellData (io.xol.chunkstories.api.world.cell.CellData)1 Chunk (io.xol.chunkstories.api.world.chunk.Chunk)1 EntityPlayer (io.xol.chunkstories.core.entity.EntityPlayer)1 ChunkRenderDataHolder (io.xol.chunkstories.renderer.chunks.ChunkRenderDataHolder)1 ClientParticlesRenderer (io.xol.chunkstories.renderer.particles.ClientParticlesRenderer)1 ClientChunk (io.xol.chunkstories.world.chunk.ClientChunk)1 Vector3d (org.joml.Vector3d)1