Search in sources :

Example 1 with IToolTipProvider

use of forestry.core.gui.tooltips.IToolTipProvider in project ForestryMC by ForestryMC.

the class GuiUtil method drawToolTips.

public static void drawToolTips(GuiForestry gui, Collection<?> objects, int mouseX, int mouseY) {
    for (Object obj : objects) {
        if (!(obj instanceof IToolTipProvider)) {
            continue;
        }
        IToolTipProvider provider = (IToolTipProvider) obj;
        if (!provider.isToolTipVisible()) {
            continue;
        }
        ToolTip tips = provider.getToolTip(mouseX - gui.getGuiLeft(), mouseY - gui.getGuiTop());
        if (tips == null) {
            continue;
        }
        boolean mouseOver = provider.isMouseOver(mouseX - gui.getGuiLeft(), mouseY - gui.getGuiTop());
        tips.onTick(mouseOver);
        if (mouseOver && tips.isReady()) {
            tips.refresh();
            drawToolTips(gui, tips, mouseX, mouseY);
        }
    }
}
Also used : ToolTip(forestry.core.gui.tooltips.ToolTip) IToolTipProvider(forestry.core.gui.tooltips.IToolTipProvider)

Aggregations

IToolTipProvider (forestry.core.gui.tooltips.IToolTipProvider)1 ToolTip (forestry.core.gui.tooltips.ToolTip)1