Skip to content

Commit

Permalink
Gl Size fix. #2
Browse files Browse the repository at this point in the history
  • Loading branch information
HyCraftHD committed Nov 18, 2017
1 parent bf221d8 commit d1748df
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/main/java/info/u_team/u_team_core/gui/UGuiContainer.java
Expand Up @@ -5,7 +5,7 @@
import static info.u_team.u_team_core.render.GLTG.vertex;

import info.u_team.u_team_core.container.UContainer;
import info.u_team.u_team_core.render.GLExtent;
import info.u_team.u_team_core.render.GLSize;
import info.u_team.u_team_core.render.GLTG;
import info.u_team.u_team_core.render.GuiRescourceLocation;
import net.minecraft.client.gui.inventory.GuiContainer;
Expand Down Expand Up @@ -33,7 +33,7 @@ public UGuiContainer(UContainer inventorySlotsIn, GuiRescourceLocation backgroun

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GLExtent size = gltg.setTexture(background);
GLSize size = gltg.setTexture(background);
GlStateManager.translate((width - size.x) / 2, (height - size.y) / 2, 0);
gltg.drawManual(data(vertex(0, 0, 0), vertex(size.x, 0, 0), vertex(size.x, size.y, 0), vertex(0, size.y, 0)), null, data(vertex(0, 0), vertex(1, 0), vertex(1, 1), vertex(0, 1)), null);
}
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/info/u_team/u_team_core/render/GLExtent.java

This file was deleted.

18 changes: 18 additions & 0 deletions src/main/java/info/u_team/u_team_core/render/GLSize.java
@@ -0,0 +1,18 @@
package info.u_team.u_team_core.render;

/**
* Gl Size
*
* @author MrTroble
* @date 18.11.2017
*
*/
public class GLSize {

public final float x, y;

public GLSize(float x, float y) {
this.x = x;
this.y = y;
}
}
4 changes: 2 additions & 2 deletions src/main/java/info/u_team/u_team_core/render/GLTG.java
Expand Up @@ -27,9 +27,9 @@ private GLTG() {
this.log = UCoreConstants.LOGGER;
}

public GLExtent setTexture(GuiRescourceLocation location) {
public GLSize setTexture(GuiRescourceLocation location) {
Minecraft.getMinecraft().getTextureManager().bindTexture(location);
return new GLExtent(GL11.glGetTexLevelParameterf(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH), GL11.glGetTexLevelParameterf(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT));
return new GLSize(GL11.glGetTexLevelParameterf(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH), GL11.glGetTexLevelParameterf(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT));
}

public void drawManual(@Nonnull float[][] vertex, float[][] color, float[][] tex, float[][] normal) {
Expand Down

0 comments on commit d1748df

Please sign in to comment.