Не двигать слоты? Двигать фон нормально?В общем, пришлось мне сделать размер гуи не 512х512 а 768х768 и начались проблемы, при изменении размера окна, слоты в гуишки теряют позицию.Как решить?
private ResourceLocation getBgTexture;
private float oldMouseX;
private float oldMouseY;
public AbstractBagContainer container;
public AbstractBagGui(AbstractBagContainer container, ResourceLocation texture) {
super(container);
this.container = container;
getBgTexture = texture;
ySize = 176;
xSize = 210;
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.pushMatrix();
GlStateManager.scale(1.5,1.5,0);
GlStateManager.color(1, 1, 1, 1);
mc.getTextureManager().bindTexture(getBgTexture);
int x = Math.round(guiLeft/1.5F);
int y = Math.round(guiTop/1.5F);
drawTexturedModalRect(x, y, 0, 0, xSize-40, ySize);
GlStateManager.popMatrix();
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
super.drawScreen(mouseX, mouseY, partialTicks);
this.oldMouseX = (float) mouseX;
this.oldMouseY = (float) mouseY;
this.renderHoveredToolTip(mouseX, mouseY);
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
GuiInventory.drawEntityOnScreen(container.firstX + 42, container.firstY + 66, 32, 80 - this.oldMouseX, 80 - this.oldMouseY, this.mc.player);
}
int x = Math.round(guiLeft/1.5F);
int y = Math.round(guiTop/1.5F);
int containerWidth = (this.width - this.xSize) / 2;
int containerHeight = (this.height - this.ySize) / 2;
// Slots
for(int i = 0; i < this.inventorySlots.inventorySlots.size(); i++)
{
int x = this.inventorySlots.getSlot(i).xDisplayPosition;
int y = this.inventorySlots.getSlot(i).yDisplayPosition;
GL11.glPushMatrix();
this.drawTexturedModalRect(containerWidth + x - 2, containerHeight + y - 2, 192, 26, 20, 21);
GL11.glPopMatrix();
}
Тогда оно не корректно, ибо мне нужно скейлить размерЧто это?Java:int x = Math.round(guiLeft/1.5F); int y = Math.round(guiTop/1.5F);
Рисуй квад от точки (guiLeft, guiTop).
GlStateManager.scale(1.5, 1.5, 0);
ySize = 176; xSize = 210;
. Сразу "заскейленые". Тогда все должно быть нормально.drawScaledCustomSizeModalRect(int x, int y, float u, float v, int uWidth, int vHeight, int width, int height, float tileWidth, float tileHeight);
drawModalRectWithCustomSizedTexture(int x, int y, float u, float v, int width, int height, float textureWidth, float textureHeight);
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.pushMatrix();
mc.getTextureManager().bindTexture(getBgTexture);
// ySize = 176;
// xSize = 225;
drawScaledCustomSizeModalRect(guiLeft, guiTop, 0, 0, xSize , ySize, xSize , ySize,432, 352);
GlStateManager.popMatrix();
}
drawScaledCustomSizeModalRect(guiLeft, guiTop, НАЧАЛО рисуемой области на текстуре по Х, ... по У, ШИРИНА рисуемой области на текстуре , ВЫСОТА ..., xSize , ySize, ПОЛНАЯ ширина текстуры, ПОЛНАЯ высота текстуры);