Search in sources :

Example 6 with IFontRenderer

use of buildcraft.lib.client.guide.font.IFontRenderer in project BuildCraft by BuildCraft.

the class GuideChapter method isMouseInside.

protected boolean isMouseInside() {
    IFontRenderer font = gui.getCurrentFont();
    String text = chapter.text;
    int width = (int) (font.getStringWidth(text) + getHoverWidth(0));
    int y = gui.minY + 20 * (gui.getChapterIndex(this) + 1);
    if (lastDrawn == EnumGuiSide.LEFT) {
        int x = gui.minX - width - 4 + 11;
        GuiRectangle drawRect = new GuiRectangle(x, y - 4, width + GuiGuide.CHAPTER_MARKER_LEFT.width, 16);
        if (drawRect.contains(gui.mouse)) {
            return true;
        }
    } else if (lastDrawn == EnumGuiSide.RIGHT) {
        int x = gui.minX + GuiGuide.PAGE_LEFT.width + GuiGuide.PAGE_RIGHT.width - 11;
        GuiRectangle drawRect = new GuiRectangle(x, y - 4, width + GuiGuide.CHAPTER_MARKER_RIGHT.width, 16);
        if (drawRect.contains(gui.mouse)) {
            return true;
        }
    }
    return false;
}
Also used : GuiRectangle(buildcraft.lib.gui.pos.GuiRectangle) IFontRenderer(buildcraft.lib.client.guide.font.IFontRenderer)

Aggregations

IFontRenderer (buildcraft.lib.client.guide.font.IFontRenderer)6 Title (buildcraft.lib.client.guide.parts.contents.ContentsList.Title)2 SubHeader (buildcraft.lib.client.guide.parts.contents.ContentsList.Title.SubHeader)2 PageLink (buildcraft.lib.client.guide.parts.contents.ContentsList.Title.SubHeader.PageLink)2 GuiRectangle (buildcraft.lib.gui.pos.GuiRectangle)2 GuiIcon (buildcraft.lib.gui.GuiIcon)1