diff options
author | Detrav <witalyezep@gmail.com> | 2016-03-21 13:13:55 +0300 |
---|---|---|
committer | Detrav <witalyezep@gmail.com> | 2016-03-21 13:13:55 +0300 |
commit | 1520e32508fe119b5017c148528342cbcc5b1abd (patch) | |
tree | f933c066a8e6a3d8765a3f64c521d95dffbea2c6 /src/main/java/com/detrav/gui | |
parent | 3136ee7505810670253dacecc83cc075b11e22c6 (diff) | |
download | GT5-Unofficial-1520e32508fe119b5017c148528342cbcc5b1abd.tar.gz GT5-Unofficial-1520e32508fe119b5017c148528342cbcc5b1abd.tar.bz2 GT5-Unofficial-1520e32508fe119b5017c148528342cbcc5b1abd.zip |
Added simple map gui
Diffstat (limited to 'src/main/java/com/detrav/gui')
-rw-r--r-- | src/main/java/com/detrav/gui/DetravGuiProPick.java | 43 | ||||
-rw-r--r-- | src/main/java/com/detrav/gui/DetravMapTexture.java | 48 |
2 files changed, 91 insertions, 0 deletions
diff --git a/src/main/java/com/detrav/gui/DetravGuiProPick.java b/src/main/java/com/detrav/gui/DetravGuiProPick.java new file mode 100644 index 0000000000..73c6973fd9 --- /dev/null +++ b/src/main/java/com/detrav/gui/DetravGuiProPick.java @@ -0,0 +1,43 @@ +package com.detrav.gui; + +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.texture.TextureUtil; + +/** + * Created by wital_000 on 21.03.2016. + */ +public class DetravGuiProPick extends GuiScreen { + public static final int GUI_ID = 20; + private static DetravMapTexture map = null; + public DetravGuiProPick() + { + + } + + public static void newMap(DetravMapTexture aMap) { + if (map != null) { + map.deleteGlTexture(); + map = null; + } + map = aMap; + map.loadTexture(null); + } + + + + @Override + public void drawScreen(int x, int y, float f) { + this.drawDefaultBackground(); + if(map!=null) + { + int aX = (this.width - map.width)/2; + int aY = (this.height - map.height)/2; + map.glBindTexture(); + this.drawTexturedModalRect(aX,aY,0,0,map.width,map.height); + } + //TextureUtil.glGenTextures() + //this.mc.renderEngine.bindTexture(); + //this.drawTexturedModelRectFromIcon(); + //this.drawTexturedModalRect(); + } +} diff --git a/src/main/java/com/detrav/gui/DetravMapTexture.java b/src/main/java/com/detrav/gui/DetravMapTexture.java new file mode 100644 index 0000000000..487bdc3b1e --- /dev/null +++ b/src/main/java/com/detrav/gui/DetravMapTexture.java @@ -0,0 +1,48 @@ +package com.detrav.gui; + +import com.detrav.net.DetravProPickPacket01; +import net.minecraft.client.renderer.texture.AbstractTexture; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.resources.IResourceManager; +import org.lwjgl.opengl.GL11; + +import java.awt.image.BufferedImage; +import java.io.IOException; + +/** + * Created by wital_000 on 21.03.2016. + */ +public class DetravMapTexture extends AbstractTexture { + + private DetravProPickPacket01 packet; + + public DetravMapTexture(DetravProPickPacket01 aPacket) + { + packet = aPacket; + } + + public int width = -1; + public int height = -1; + + @Override + public void loadTexture(IResourceManager p_110551_1_){ + this.deleteGlTexture(); + if(packet!=null) + { + int tId = getGlTextureId(); + if(tId <0) return; + BufferedImage bufferedimage = packet.getImage(); + TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, false, false); + width = bufferedimage.getWidth(); + height = bufferedimage.getHeight(); + } + //GL11.glDrawPixels(); + } + + public int glBindTexture() { + if (this.glTextureId < 0) return this.glTextureId; + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.getGlTextureId()); + return this.glTextureId; + } + +} |