Search in sources :

Example 1 with EnumDatabaseTab

use of forestry.api.genetics.EnumDatabaseTab in project ForestryMC by ForestryMC.

the class WidgetDatabaseTabs method drawTabs.

public void drawTabs(int startX, int startY) {
    for (int tabIndex = 0; tabIndex < TABS.length; tabIndex++) {
        if (tabIndex == selectedTab) {
            continue;
        }
        EnumDatabaseTab tab = TABS[tabIndex];
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        Drawable tabTexture = GUI_TAB;
        int xPos = this.xPos + tabIndex * (GUI_TAB.width + spacing);
        tabTexture.draw(xPos, yPos - 4);
        GuiUtil.drawItemStack(manager.gui, parent.getItemStack(tab), startX + xPos + 6, startY + yPos + 2);
    }
}
Also used : EnumDatabaseTab(forestry.api.genetics.EnumDatabaseTab) Drawable(forestry.core.gui.Drawable)

Example 2 with EnumDatabaseTab

use of forestry.api.genetics.EnumDatabaseTab in project ForestryMC by ForestryMC.

the class WidgetDatabaseTabs method drawSelectedTab.

public void drawSelectedTab(int startX, int startY) {
    // Check if a tab is selected
    if (selectedTab < 0) {
        return;
    }
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    EnumDatabaseTab tab = TABS[selectedTab];
    int textureIndex = selectedTab == 0 ? 0 : selectedTab == TABS.length - 1 ? 2 : 1;
    Drawable tabTexture;
    if (textureIndex == 0) {
        tabTexture = GUI_TAB_ACTIVE_LEFT;
    } else if (textureIndex == 2) {
        tabTexture = GUI_TAB_ACTIVE_RIGHT;
    } else {
        tabTexture = GUI_TAB_ACTIVE_CENTER;
    }
    int xPos = this.xPos + selectedTab * (GUI_TAB.width + spacing);
    tabTexture.draw(xPos, yPos - 4);
    GuiUtil.drawItemStack(manager.gui, parent.getItemStack(tab), startX + xPos + 6, startY + yPos + 2);
}
Also used : EnumDatabaseTab(forestry.api.genetics.EnumDatabaseTab) Drawable(forestry.core.gui.Drawable)

Example 3 with EnumDatabaseTab

use of forestry.api.genetics.EnumDatabaseTab in project ForestryMC by ForestryMC.

the class WidgetDatabaseTabs method getToolTip.

@Nullable
@Override
public ToolTip getToolTip(int mouseX, int mouseY) {
    int mouseOverTab = getMouseOverTab(mouseX, mouseY);
    if (mouseOverTab < 0) {
        return null;
    }
    EnumDatabaseTab tab = TABS[mouseOverTab];
    ToolTip toolTip = new ToolTip();
    toolTip.add(parent.getTooltip(tab));
    return toolTip;
}
Also used : EnumDatabaseTab(forestry.api.genetics.EnumDatabaseTab) ToolTip(forestry.core.gui.tooltips.ToolTip) Nullable(javax.annotation.Nullable)

Aggregations

EnumDatabaseTab (forestry.api.genetics.EnumDatabaseTab)3 Drawable (forestry.core.gui.Drawable)2 ToolTip (forestry.core.gui.tooltips.ToolTip)1 Nullable (javax.annotation.Nullable)1