Search in sources :

Example 6 with Font

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

the class LevelSelection method render.

@Override
public void render(RenderingInterface renderer) {
    parentLayer.getRootLayer().render(renderer);
    if (scroll < 0)
        scroll = 0;
    int posY = renderer.getWindow().getHeight() - 128;
    Font font = renderer.getFontRenderer().getFont("LiberationSans-Regular", 11);
    renderer.getFontRenderer().drawStringWithShadow(font, 64, posY + 64, "Select a level...", 3, 3, new Vector4f(1));
    int remainingSpace = (int) Math.floor(renderer.getWindow().getHeight() / 96 - 2);
    while (scroll + remainingSpace > worldsButtons.size()) scroll--;
    int skip = scroll;
    for (LocalWorldButton worldButton : worldsButtons) {
        if (skip-- > 0)
            continue;
        if (remainingSpace-- <= 0)
            break;
        int maxWidth = renderer.getWindow().getWidth() - 64 * 2;
        worldButton.setWidth(maxWidth);
        worldButton.setPosition(64, posY);
        worldButton.render(renderer);
        posY -= 96;
    }
    backOption.setPosition(8, 8);
    backOption.render(renderer);
    newWorldOption.setPosition(renderer.getWindow().getWidth() - newWorldOption.getWidth() - 8, 8);
    newWorldOption.render(renderer);
}
Also used : Vector4f(org.joml.Vector4f) Font(io.xol.chunkstories.api.rendering.text.FontRenderer.Font)

Example 7 with Font

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

the class LogPolicyAsk method render.

@Override
public void render(RenderingInterface renderer) {
    parentLayer.render(renderer);
    float scale = gameWindow.getGuiScale();
    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.getFontRenderer().drawStringWithShadow(renderer.getFontRenderer().getFont("LiberationSans-Regular__aa", 16 * scale), 30, renderer.getWindow().getHeight() - 64, Client.getInstance().getContent().localization().getLocalizedString("logpolicy.title"), 1, 1, new Vector4f(1));
    Font logPolicyTextFont = renderer.getFontRenderer().getFont("LiberationSans-Regular__aa", 12 * scale);
    renderer.getFontRenderer().drawString(logPolicyTextFont, 30, renderer.getWindow().getHeight() - 128, message, 1, width - 60);
    float seperation = 4 * scale;
    float groupSize = acceptButton.getWidth() + refuseButton.getWidth() + seperation;
    acceptButton.setPosition(renderer.getWindow().getWidth() / 2 - groupSize / 2, renderer.getWindow().getHeight() / 4 - 32);
    acceptButton.render(renderer);
    refuseButton.setPosition(renderer.getWindow().getWidth() / 2 - groupSize / 2 + seperation + acceptButton.getWidth(), renderer.getWindow().getHeight() / 4 - 32);
    refuseButton.render(renderer);
}
Also used : Vector4f(org.joml.Vector4f) Font(io.xol.chunkstories.api.rendering.text.FontRenderer.Font)

Example 8 with Font

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

the class ModsSelection method render.

@Override
public void render(RenderingInterface renderer) {
    parentLayer.getRootLayer().render(renderer);
    int scale = Client.getInstance().getGameWindow().getGuiScale();
    String instructions = "Select the mods you want to use";
    Font font = renderer.getFontRenderer().getFont("LiberationSans-Regular", 16 * scale);
    renderer.getFontRenderer().drawStringWithShadow(font, 32, renderer.getWindow().getHeight() - 24 * scale, instructions, 1, 1, new Vector4f(1));
    backOption.setPosition(xPosition + 8, 8);
    backOption.render(renderer);
    // Display buttons
    float totalLengthOfButtons = 0;
    float spacing = 2 * scale;
    totalLengthOfButtons += applyMods.getWidth();
    totalLengthOfButtons += spacing;
    totalLengthOfButtons += locateExtMod.getWidth();
    totalLengthOfButtons += spacing;
    // totalLengthOfButtons += openModsFolder.getWidth();
    // totalLengthOfButtons += spacing;
    float buttonDisplayX = renderer.getWindow().getWidth() / 2 - totalLengthOfButtons / 2;
    float buttonDisplayY = 8;
    locateExtMod.setPosition(buttonDisplayX, buttonDisplayY);
    buttonDisplayX += locateExtMod.getWidth() + spacing;
    locateExtMod.render(renderer);
    openModsFolder.setPosition(buttonDisplayX, buttonDisplayY);
    buttonDisplayX += openModsFolder.getWidth() + spacing;
    openModsFolder.render(renderer);
    applyMods.setPosition(this.getWidth() - applyMods.getWidth() - 8, 8);
    buttonDisplayX += applyMods.getWidth() + spacing;
    applyMods.render(renderer);
    float offsetForButtons = applyMods.getPositionY() + applyMods.getHeight() + 8 * scale;
    float offsetForHeaderText = 32 * scale;
    modsContainer.setPosition((width - 480 * scale) / 2, offsetForButtons);
    modsContainer.setDimensions(480 * scale, height - (offsetForButtons + offsetForHeaderText));
    modsContainer.render(renderer);
}
Also used : Vector4f(org.joml.Vector4f) Font(io.xol.chunkstories.api.rendering.text.FontRenderer.Font)

Example 9 with Font

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

the class ChatManager method render.

public void render(RenderingInterface renderer) {
    while (chat.size() > chatHistorySize) chat.removeLast();
    if (// || !chatting)
    scroll < 0)
        scroll = 0;
    if (scroll > chatHistorySize)
        scroll = chatHistorySize;
    int scrollLinesSkip = scroll;
    int linesDrew = 0;
    int maxLines = 18;
    Iterator<ChatLine> i = chat.iterator();
    while (linesDrew < maxLines && i.hasNext()) {
        // if (a >= chatHistorySize - lines)
        ChatLine line = i.next();
        if (scrollLinesSkip > 0) {
            scrollLinesSkip--;
            continue;
        }
        Font font = renderer.getFontRenderer().getFont("LiberationSans-Regular", 12);
        float scale = 2f;
        font = renderer.getFontRenderer().getFont("LiberationSans-Regular__aa", 18);
        scale = 1.0f;
        int chatWidth = Math.max(750, Client.getInstance().getGameWindow().getWidth() / 4 * 3);
        String localizedLine = Client.getInstance().getContent().localization().localize(line.text);
        int actualLines = font.getLinesHeight(localizedLine, chatWidth / scale);
        linesDrew += actualLines;
        float alpha = (line.time + 10000L - System.currentTimeMillis()) / 1000f;
        if (alpha < 0)
            alpha = 0;
        if (alpha > 1 || ingame.getGameWindow().getLayer() instanceof ChatPanelOverlay)
            alpha = 1;
        renderer.getFontRenderer().drawStringWithShadow(font, 9, (linesDrew - 1) * font.getLineHeight() * scale + 180 + (50), localizedLine, scale, scale, chatWidth, new Vector4f(1, 1, 1, alpha));
    }
}
Also used : Vector4f(org.joml.Vector4f) Font(io.xol.chunkstories.api.rendering.text.FontRenderer.Font)

Example 10 with Font

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

the class PauseMenu method render.

@Override
public void render(RenderingInterface renderer) {
    parentLayer.render(renderer);
    Font font = renderer.getFontRenderer().getFont("LiberationSans-Regular", 11);
    String pauseText = renderer.getClient().getContent().localization().getLocalizedString("ingame.pause");
    renderer.getFontRenderer().drawStringWithShadow(font, renderer.getWindow().getWidth() / 2 - font.getWidth(pauseText) * 1.5f, renderer.getWindow().getHeight() / 2 + 48 * 3, pauseText, 3, 3, new Vector4f(1));
    resumeButton.setPosition(renderer.getWindow().getWidth() / 2 - resumeButton.getWidth() / 2, renderer.getWindow().getHeight() / 2 + 24 * 2 * getGuiScale());
    optionsButton.setPosition(resumeButton.getPositionX(), renderer.getWindow().getHeight() / 2 + 24 * getGuiScale());
    exitButton.setPosition(resumeButton.getPositionX(), renderer.getWindow().getHeight() / 2 - 24 * getGuiScale());
    resumeButton.render(renderer);
    optionsButton.render(renderer);
    exitButton.render(renderer);
}
Also used : Vector4f(org.joml.Vector4f) 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