Background sprites
|
@ -131,7 +131,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
|
|||
renderBackground(drawContext);
|
||||
boolean drawPlayerSlots = selectedTab == null && drawPlayerSlots();
|
||||
updateSlotDraw(drawPlayerSlots);
|
||||
builder.drawDefaultBackground(drawContext, this, x, y, xSize, ySize);
|
||||
builder.drawDefaultBackground(drawContext, x, y, xSize, ySize);
|
||||
if (drawPlayerSlots) {
|
||||
builder.drawPlayerSlots(drawContext, this, x + backgroundWidth / 2, y + 93, true);
|
||||
}
|
||||
|
|
|
@ -53,19 +53,23 @@ import java.util.stream.Collectors;
|
|||
|
||||
import static reborncore.client.gui.GuiSprites.drawSprite;
|
||||
|
||||
/**
|
||||
* Created by Gigabit101 on 08/08/2016.
|
||||
*/
|
||||
public class GuiBuilder {
|
||||
private static final Text SPACE_TEXT = Text.literal(" ");
|
||||
public static final Identifier resourceLocation = new Identifier("reborncore", "textures/gui/guielements.png");
|
||||
|
||||
public void drawDefaultBackground(DrawContext drawContext, Screen gui, int x, int y, int width, int height) {
|
||||
drawContext.drawTexture(resourceLocation, x, y, 0, 0, width / 2, height / 2);
|
||||
drawContext.drawTexture(resourceLocation, x + width / 2, y, 150 - width / 2, 0, width / 2, height / 2);
|
||||
drawContext.drawTexture(resourceLocation, x, y + height / 2, 0, 150 - height / 2, width / 2, height / 2);
|
||||
drawContext.drawTexture(resourceLocation, x + width / 2, y + height / 2, 150 - width / 2, 150 - height / 2, width / 2,
|
||||
height / 2);
|
||||
public void drawDefaultBackground(DrawContext drawContext, int x, int y, int width, int height) {
|
||||
int corner = 4;
|
||||
drawContext.drawSprite(x + 3, y + 3, 0, width - 6, height - 6, GuiBase.getSprite(GuiSprites.BACKGROUND_BODY));
|
||||
drawContext.drawSprite(x + corner, y, 0, width - corner - corner, 3, GuiBase.getSprite(GuiSprites.BACKGROUND_EDGE_TOP));
|
||||
drawContext.drawSprite(x + corner, y + height - corner, 0, width - corner - corner, 3, GuiBase.getSprite(GuiSprites.BACKGROUND_EDGE_BOTTOM));
|
||||
drawContext.drawSprite(x, y + corner, 0, 3, height - corner - corner, GuiBase.getSprite(GuiSprites.BACKGROUND_EDGE_LEFT));
|
||||
drawContext.drawSprite(x + width - corner, y + 3, 0, 3, height - corner - corner, GuiBase.getSprite(GuiSprites.BACKGROUND_EDGE_RIGHT));
|
||||
|
||||
drawSprite(drawContext, GuiSprites.BACKGROUND_CORNER_TOP_LEFT, x, y);
|
||||
drawSprite(drawContext, GuiSprites.BACKGROUND_CORNER_TOP_RIGHT, x + width - 5, y);
|
||||
|
||||
drawSprite(drawContext, GuiSprites.BACKGROUND_CORNER_BOTTOM_LEFT, x, y + height - 5);
|
||||
drawSprite(drawContext, GuiSprites.BACKGROUND_CORNER_BOTTOM_RIGHT, x + height - 5, y + width - 5);
|
||||
}
|
||||
|
||||
public void drawPlayerSlots(DrawContext drawContext, Screen gui, int posX, int posY, boolean center) {
|
||||
|
|
|
@ -70,6 +70,16 @@ public final class GuiSprites {
|
|||
public static final SpriteIdentifier POWER_BAR_BASE = create("power_bar_base");
|
||||
public static final SpriteIdentifier POWER_BAR_OVERLAY = create("power_bar_overlay");
|
||||
|
||||
public static final SpriteIdentifier BACKGROUND_BODY = create("background_body");
|
||||
public static final SpriteIdentifier BACKGROUND_EDGE_BOTTOM = create("background_edge_bottom");
|
||||
public static final SpriteIdentifier BACKGROUND_EDGE_LEFT = create("background_edge_left");
|
||||
public static final SpriteIdentifier BACKGROUND_EDGE_RIGHT = create("background_edge_right");
|
||||
public static final SpriteIdentifier BACKGROUND_EDGE_TOP = create("background_edge_top");
|
||||
public static final SpriteIdentifier BACKGROUND_CORNER_TOP_LEFT= create("background_corner_top_left");
|
||||
public static final SpriteIdentifier BACKGROUND_CORNER_TOP_RIGHT = create("background_corner_top_right");
|
||||
public static final SpriteIdentifier BACKGROUND_CORNER_BOTTOM_LEFT= create("background_corner_bottom_left");
|
||||
public static final SpriteIdentifier BACKGROUND_CORNER_BOTTOM_RIGHT = create("background_corner_bottom_right");
|
||||
|
||||
public static final SpriteIdentifier EXIT_BUTTON_NORMAL = create("exit_button_normal");
|
||||
public static final SpriteIdentifier EXIT_BUTTON_HOVERED = create("exit_button_hovered");
|
||||
public static final Button EXIT_BUTTON = new Button(EXIT_BUTTON_NORMAL, EXIT_BUTTON_HOVERED);
|
||||
|
|
|
@ -51,7 +51,16 @@ public abstract class AbstractConfigPopupElement extends ElementBase {
|
|||
|
||||
@Override
|
||||
public final void draw(DrawContext drawContext, GuiBase<?> gui, int mouseX, int mouseY) {
|
||||
drawDefaultBackground(drawContext, gui, adjustX(gui, getX() - 8), adjustY(gui, getY() - 7), 84, 105 + (filter ? 15 : 0));
|
||||
drawContext.getMatrices().push();
|
||||
gui.builder.drawDefaultBackground(
|
||||
drawContext,
|
||||
adjustX(gui, getX() - 8),
|
||||
adjustY(gui, getY() - 7),
|
||||
84,
|
||||
105 + (filter ? 15 : 0)
|
||||
);
|
||||
drawContext.getMatrices().pop();
|
||||
|
||||
super.draw(drawContext, gui, mouseX, mouseY);
|
||||
|
||||
final MachineBaseBlockEntity machine = ((MachineBaseBlockEntity) gui.be);
|
||||
|
|
|
@ -25,11 +25,9 @@
|
|||
package reborncore.client.gui.config.elements;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.client.gui.GuiBase;
|
||||
import reborncore.client.gui.GuiBuilder;
|
||||
import reborncore.client.gui.GuiSprites;
|
||||
|
||||
public class ElementBase {
|
||||
|
@ -96,11 +94,4 @@ public class ElementBase {
|
|||
public void drawSprite(DrawContext drawContext, GuiBase<?> gui, SpriteIdentifier spriteIdentifier, int x, int y) {
|
||||
GuiSprites.drawSprite(drawContext, spriteIdentifier, x + gui.getGuiLeft(), y + gui.getGuiTop());
|
||||
}
|
||||
|
||||
public void drawDefaultBackground(DrawContext drawContext, Screen gui, int x, int y, int width, int height) {
|
||||
drawContext.drawTexture(GuiBuilder.resourceLocation, x, y, 0, 0, width / 2, height / 2);
|
||||
drawContext.drawTexture(GuiBuilder.resourceLocation, x + width / 2, y, 150 - width / 2, 0, width / 2, height / 2);
|
||||
drawContext.drawTexture(GuiBuilder.resourceLocation, x, y + height / 2, 0, 150 - height / 2, width / 2, height / 2);
|
||||
drawContext.drawTexture(GuiBuilder.resourceLocation, x + width / 2, y + height / 2, 150 - width / 2, 150 - height / 2, width / 2, height / 2);
|
||||
}
|
||||
}
|
||||
|
|
After Width: | Height: | Size: 70 B |
After Width: | Height: | Size: 78 B |
After Width: | Height: | Size: 102 B |
After Width: | Height: | Size: 97 B |
After Width: | Height: | Size: 91 B |
After Width: | Height: | Size: 100 B |
After Width: | Height: | Size: 74 B |
After Width: | Height: | Size: 78 B |
After Width: | Height: | Size: 78 B |
After Width: | Height: | Size: 80 B |