You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.1 KiB
Java

package net.brokenmoon.afloydwiremod.gui;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.GuiButton;
import net.minecraft.src.GuiScreen;
import org.lwjgl.input.Mouse;
public class GuiScrollable extends GuiScreen {
public EntityPlayer player;
private int scroll;
@Override
public void drawScreen(int x, int y, float renderPartialTicks) {
//TODO: Tweak these values later to fit all the stuff
int wheel = Mouse.getDWheel();
if(wheel > 0)
scroll++;
if (wheel < 0)
scroll--;
if(scroll > 150)
scroll = 150;
if(scroll < 0)
scroll = 0;
for (int i = 0; i < this.controlList.size(); ++i) {
GuiButtonExtended guibutton = (GuiButtonExtended)this.controlList.get(i);
if(scroll >= 0)
guibutton.scroll = scroll;
if(scroll <= 0)
guibutton.scroll = scroll;
if(guibutton.yPosition >= 50 && guibutton.yPosition <= 200)
guibutton.drawButton(this.mc, x, y);
}
}
}