Search in sources :

Example 1 with GuidePageBase

use of buildcraft.lib.client.guide.parts.GuidePageBase in project BuildCraft by BuildCraft.

the class GuiGuide method mouseClicked.

@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
    mouse.setMousePosition(mouseX, mouseY);
    // Primary mouse button
    if (mouseButton == 0) {
        if (isOpen) {
            int page0xMin = this.minX + (int) PAGE_LEFT_TEXT.x;
            int page0xMax = page0xMin + (int) PAGE_LEFT_TEXT.width;
            int page1xMin = this.minX + PAGE_LEFT.width + (int) PAGE_RIGHT_TEXT.x;
            int page1xMax = page1xMin + (int) PAGE_RIGHT_TEXT.width;
            int pageYMin = this.minY + (int) PAGE_RIGHT_TEXT.y;
            int pageYMax = pageYMin + (int) PAGE_RIGHT_TEXT.height;
            GuidePageBase current = currentPage;
            current.setFontRenderer(currentFont);
            for (GuideChapter chapter : chapters) {
                if (chapter.handleClick()) {
                    return;
                }
            }
            current.handleMouseClick(page0xMin, pageYMin, page0xMax - page0xMin, pageYMax - pageYMin, mouseX, mouseY, mouseButton, currentPage.getPage(), isEditing);
            current.handleMouseClick(page1xMin, pageYMin, page1xMax - page1xMin, pageYMax - pageYMin, mouseX, mouseY, mouseButton, currentPage.getPage() + 1, isEditing);
            if ((!pages.isEmpty()) && BACK_POSITION.offset(minX, minY).contains(mouse)) {
                closePage();
            }
            if (isOverHover) {
                isEditing = !isEditing;
                if (!isEditing) {
                    hoverStageNext = PEN_UP.height;
                }
            }
        } else {
            if (mouseX >= minX && mouseY >= minY && mouseX <= minX + BOOK_COVER.width && mouseY <= minY + BOOK_COVER.height) {
                if (isOpening) {
                    // So you can double-click to open it instantly
                    isOpen = true;
                }
                isOpening = true;
            }
        }
    }
}
Also used : GuideChapter(buildcraft.lib.client.guide.parts.GuideChapter) GuidePageBase(buildcraft.lib.client.guide.parts.GuidePageBase)

Example 2 with GuidePageBase

use of buildcraft.lib.client.guide.parts.GuidePageBase in project BuildCraft by BuildCraft.

the class GuiGuide method goBackToMenu.

public void goBackToMenu() {
    GuidePageBase newPage = currentPage;
    while (!pages.isEmpty()) {
        newPage = pages.pop();
    }
    setPageInternal(newPage);
}
Also used : GuidePageBase(buildcraft.lib.client.guide.parts.GuidePageBase)

Aggregations

GuidePageBase (buildcraft.lib.client.guide.parts.GuidePageBase)2 GuideChapter (buildcraft.lib.client.guide.parts.GuideChapter)1