Enable collecting items from map to equipment
This commit is contained in:
43
src/main/java/com/bartlomiejpluta/demo/gui/ItemIconView.java
Normal file
43
src/main/java/com/bartlomiejpluta/demo/gui/ItemIconView.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.bartlomiejpluta.demo.gui;
|
||||
|
||||
import com.bartlomiejpluta.base.api.context.Context;
|
||||
import com.bartlomiejpluta.base.api.gui.Color;
|
||||
import com.bartlomiejpluta.base.api.gui.GUI;
|
||||
import com.bartlomiejpluta.base.api.screen.Screen;
|
||||
import com.bartlomiejpluta.base.lib.gui.IconView;
|
||||
|
||||
public class ItemIconView extends IconView {
|
||||
private final Color normal;
|
||||
private final Color hover;
|
||||
|
||||
public ItemIconView(Context context, GUI gui) {
|
||||
super(context, gui);
|
||||
this.normal = gui.createColor();
|
||||
this.hover = gui.createColor();
|
||||
|
||||
normal.setRGBA(0x444444FF);
|
||||
hover.setRGBA(0x888888FF);
|
||||
super.setScale(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getContentWidth() {
|
||||
return 68f;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getContentHeight() {
|
||||
return 68f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Screen screen, GUI gui) {
|
||||
gui.beginPath();
|
||||
gui.drawRectangle(x, y, getWidth(), getHeight());
|
||||
gui.setFillColor(focused ? hover : normal);
|
||||
gui.fill();
|
||||
gui.closePath();
|
||||
|
||||
super.draw(screen, gui);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user