mirror of
https://github.com/GTNewHorizons/JustEnoughCalculation.git
synced 2026-11-26 23:02:57 +00:00
feat: clean up
This commit is contained in:
1 parent
0f1f888299
commit
fa3ba7542c
55 files changed
+611
-490
No files matched your search
@@ -0,0 +1,53 @@
|
||||
package me.towdium.jecalculation.gui.widgets;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import me.towdium.jecalculation.gui.JecaGui;
|
||||
import me.towdium.jecalculation.gui.Resource;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Author: towdium
|
||||
* Date: 17-9-15.
|
||||
* Base panel of GUIs
|
||||
*/
|
||||
@ParametersAreNonnullByDefault
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class WPanel implements IWidget {
|
||||
int xPos, yPos, xSize, ySize;
|
||||
|
||||
public WPanel(int xPos, int yPos, int xSize, int ySize) {
|
||||
this.xPos = xPos;
|
||||
this.yPos = yPos;
|
||||
this.xSize = xSize;
|
||||
this.ySize = ySize;
|
||||
}
|
||||
|
||||
public WPanel() {
|
||||
this(0, 0, 176, 166);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDraw(JecaGui gui, int xMouse, int yMouse) {
|
||||
gui.drawResourceContinuous(Resource.WGT_PANEL_F, xPos, yPos, xSize, ySize, 5, 5, 5, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTooltip(JecaGui gui, int xMouse, int yMouse, List<String> tooltip) {
|
||||
return mouseIn(xMouse, yMouse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onClicked(JecaGui gui, int xMouse, int yMouse, int button) {
|
||||
return mouseIn(xMouse, yMouse);
|
||||
}
|
||||
|
||||
public boolean mouseIn(int x, int y) {
|
||||
int xx = x - xPos;
|
||||
int yy = y - yPos;
|
||||
return xx >= 0 && xx < xSize && yy >= 0 && yy < ySize;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user