本文整理匯總了Java中net.minecraft.client.gui.ScaledResolution.getScaleFactor方法的典型用法代碼示例。如果您正苦於以下問題:Java ScaledResolution.getScaleFactor方法的具體用法?Java ScaledResolution.getScaleFactor怎麽用?Java ScaledResolution.getScaleFactor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.client.gui.ScaledResolution
的用法示例。
在下文中一共展示了ScaledResolution.getScaleFactor方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawScreen
import net.minecraft.client.gui.ScaledResolution; //導入方法依賴的package包/類
public void drawScreen(int x, int y, float par3) {
GL11.glPushMatrix();
ScaledResolution scaledRes = new ScaledResolution(this.mc);
float scale = (float)scaledRes.getScaleFactor() / (float)Math.pow(scaledRes.getScaleFactor(), 2.0);
GL11.glScalef((float)scale, (float)scale, (float)scale);
int mouseX = Mouse.getX();
int mouseY = Display.getHeight() - Mouse.getY();
Gui.instance.update(mouseX, mouseY);
Gui.instance.render();
GL11.glPopMatrix();
if (Mouse.hasWheel()) {
int wheel = Mouse.getDWheel();
this.scrollVelocity = wheel < 0 ? -120 : (wheel > 0 ? 120 : 0);
}
Gui.instance.mouseScroll(this.scrollVelocity);
}
示例2: convertPointToScaled
import net.minecraft.client.gui.ScaledResolution; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public static Point convertPointToScaled(Point original) {
int originalWidth = getDisplayWidth();
int originalHeight = getDisplayHeight();
ScaledResolution sr = getScaledResolution();
return new Point(
MiscUtils.ConvertRange(
0,
originalWidth,
0,
sr.getScaledWidth(),
original.getX()
) * sr.getScaleFactor(),
MiscUtils.ConvertRange(
0,
originalHeight,
0,
sr.getScaledHeight(),
original.getY()
) * sr.getScaleFactor()
);
}
示例3: scissorBox
import net.minecraft.client.gui.ScaledResolution; //導入方法依賴的package包/類
public static void scissorBox(int x, int y, int xend, int yend)
{
int width = xend - x;
int height = yend - y;
ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
int factor = sr.getScaleFactor();
int bottomY = Minecraft.getMinecraft().currentScreen.height - yend;
glScissor(x * factor, bottomY * factor, width * factor,
height * factor);
}
示例4: scissorBox
import net.minecraft.client.gui.ScaledResolution; //導入方法依賴的package包/類
public static void scissorBox(int x, int y, int xend, int yend) {
int width = xend - x;
int height = yend - y;
ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
int factor = sr.getScaleFactor();
int bottomY = Minecraft.getMinecraft().currentScreen.height - yend;
glScissor(x * factor, bottomY * factor, width * factor, height * factor);
}
示例5: drawSplashScreen
import net.minecraft.client.gui.ScaledResolution; //導入方法依賴的package包/類
private void drawSplashScreen(TextureManager textureManagerInstance) throws LWJGLException
{
ScaledResolution scaledresolution = new ScaledResolution(this);
int i = scaledresolution.getScaleFactor();
Framebuffer framebuffer = new Framebuffer(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i, true);
framebuffer.bindFramebuffer(false);
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)scaledresolution.getScaledWidth(), (double)scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GlStateManager.disableLighting();
GlStateManager.disableFog();
GlStateManager.disableDepth();
GlStateManager.enableTexture2D();
InputStream inputstream = null;
try
{
inputstream = this.mcDefaultResourcePack.getInputStream(locationMojangPng);
this.mojangLogo = textureManagerInstance.getDynamicTextureLocation("logo", new DynamicTexture(ImageIO.read(inputstream)));
textureManagerInstance.bindTexture(this.mojangLogo);
}
catch (IOException ioexception)
{
logger.error((String)("Unable to load logo: " + locationMojangPng), (Throwable)ioexception);
}
finally
{
IOUtils.closeQuietly(inputstream);
}
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos(0.0D, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
worldrenderer.pos((double)this.displayWidth, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
worldrenderer.pos((double)this.displayWidth, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
worldrenderer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
tessellator.draw();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
int j = 256;
int k = 256;
this.func_181536_a((scaledresolution.getScaledWidth() - j) / 2, (scaledresolution.getScaledHeight() - k) / 2, 0, 0, j, k, 255, 255, 255, 255);
GlStateManager.disableLighting();
GlStateManager.disableFog();
framebuffer.unbindFramebuffer();
framebuffer.framebufferRender(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i);
GlStateManager.enableAlpha();
GlStateManager.alphaFunc(516, 0.1F);
this.updateDisplay();
}
示例6: showLagometer
import net.minecraft.client.gui.ScaledResolution; //導入方法依賴的package包/類
public static void showLagometer(ScaledResolution p_showLagometer_0_)
{
if (gameSettings != null)
{
if (gameSettings.ofLagometer || gameSettings.field_181657_aC)
{
long i = System.nanoTime();
GlStateManager.clear(256);
GlStateManager.matrixMode(5889);
GlStateManager.pushMatrix();
GlStateManager.enableColorMaterial();
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)mc.displayWidth, (double)mc.displayHeight, 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GL11.glLineWidth(1.0F);
GlStateManager.disableTexture2D();
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(1, DefaultVertexFormats.POSITION_COLOR);
for (int j = 0; j < timesFrame.length; ++j)
{
int k = (j - numRecordedFrameTimes & timesFrame.length - 1) * 100 / timesFrame.length;
k = k + 155;
float f = (float)mc.displayHeight;
long l = 0L;
if (gcs[j])
{
renderTime(j, timesFrame[j], k, k / 2, 0, f, worldrenderer);
}
else
{
renderTime(j, timesFrame[j], k, k, k, f, worldrenderer);
f = f - (float)renderTime(j, timesServer[j], k / 2, k / 2, k / 2, f, worldrenderer);
f = f - (float)renderTime(j, timesTerrain[j], 0, k, 0, f, worldrenderer);
f = f - (float)renderTime(j, timesVisibility[j], k, k, 0, f, worldrenderer);
f = f - (float)renderTime(j, timesChunkUpdate[j], k, 0, 0, f, worldrenderer);
f = f - (float)renderTime(j, timesChunkUpload[j], k, 0, k, f, worldrenderer);
f = f - (float)renderTime(j, timesScheduledExecutables[j], 0, 0, k, f, worldrenderer);
float f2 = f - (float)renderTime(j, timesTick[j], 0, k, k, f, worldrenderer);
}
}
renderTimeDivider(0, timesFrame.length, 33333333L, 196, 196, 196, (float)mc.displayHeight, worldrenderer);
renderTimeDivider(0, timesFrame.length, 16666666L, 196, 196, 196, (float)mc.displayHeight, worldrenderer);
tessellator.draw();
GlStateManager.enableTexture2D();
int j2 = mc.displayHeight - 80;
int k2 = mc.displayHeight - 160;
mc.fontRendererObj.drawString("30", 2, k2 + 1, -8947849);
mc.fontRendererObj.drawString("30", 1, k2, -3881788);
mc.fontRendererObj.drawString("60", 2, j2 + 1, -8947849);
mc.fontRendererObj.drawString("60", 1, j2, -3881788);
GlStateManager.matrixMode(5889);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
float f1 = 1.0F - (float)((double)(System.currentTimeMillis() - memTimeStartMs) / 1000.0D);
f1 = Config.limit(f1, 0.0F, 1.0F);
int l2 = (int)(170.0F + f1 * 85.0F);
int i1 = (int)(100.0F + f1 * 55.0F);
int j1 = (int)(10.0F + f1 * 10.0F);
int k1 = l2 << 16 | i1 << 8 | j1;
int l1 = 512 / p_showLagometer_0_.getScaleFactor() + 2;
int i2 = mc.displayHeight / p_showLagometer_0_.getScaleFactor() - 8;
GuiIngame guiingame = mc.ingameGUI;
GuiIngame.drawRect(l1 - 1, i2 - 1, l1 + 50, i2 + 10, -1605349296);
mc.fontRendererObj.drawString(" " + memMbSec + " MB/s", l1, i2, k1);
renderTimeNano = System.nanoTime() - i;
}
}
}
示例7: showLagometer
import net.minecraft.client.gui.ScaledResolution; //導入方法依賴的package包/類
public static void showLagometer(ScaledResolution p_showLagometer_0_)
{
if (gameSettings != null && gameSettings.ofLagometer)
{
long i = System.nanoTime();
GlStateManager.clear(256);
GlStateManager.matrixMode(5889);
GlStateManager.pushMatrix();
GlStateManager.enableColorMaterial();
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)mc.displayWidth, (double)mc.displayHeight, 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GL11.glLineWidth(1.0F);
GlStateManager.disableTexture2D();
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(1, DefaultVertexFormats.POSITION_COLOR);
for (int j = 0; j < timesFrame.length; ++j)
{
int k = (j - numRecordedFrameTimes & timesFrame.length - 1) * 100 / timesFrame.length;
k = k + 155;
float f = (float)mc.displayHeight;
long l = 0L;
if (gcs[j])
{
renderTime(j, timesFrame[j], k, k / 2, 0, f, worldrenderer);
}
else
{
renderTime(j, timesFrame[j], k, k, k, f, worldrenderer);
f = f - (float)renderTime(j, timesServer[j], k / 2, k / 2, k / 2, f, worldrenderer);
f = f - (float)renderTime(j, timesTerrain[j], 0, k, 0, f, worldrenderer);
f = f - (float)renderTime(j, timesVisibility[j], k, k, 0, f, worldrenderer);
f = f - (float)renderTime(j, timesChunkUpdate[j], k, 0, 0, f, worldrenderer);
f = f - (float)renderTime(j, timesChunkUpload[j], k, 0, k, f, worldrenderer);
f = f - (float)renderTime(j, timesScheduledExecutables[j], 0, 0, k, f, worldrenderer);
float f2 = f - (float)renderTime(j, timesTick[j], 0, k, k, f, worldrenderer);
}
}
tessellator.draw();
GlStateManager.matrixMode(5889);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
float f1 = 1.0F - (float)((double)(System.currentTimeMillis() - memTimeStartMs) / 1000.0D);
f1 = Config.limit(f1, 0.0F, 1.0F);
int l1 = (int)(170.0F + f1 * 85.0F);
int i2 = (int)(100.0F + f1 * 55.0F);
int j2 = (int)(10.0F + f1 * 10.0F);
int i1 = l1 << 16 | i2 << 8 | j2;
int j1 = 512 / p_showLagometer_0_.getScaleFactor() + 2;
int k1 = mc.displayHeight / p_showLagometer_0_.getScaleFactor() - 8;
GuiIngame guiingame = mc.ingameGUI;
GuiIngame.drawRect(j1 - 1, k1 - 1, j1 + 50, k1 + 10, -1605349296);
mc.fontRendererObj.drawString(" " + memMbSec + " MB/s", j1, k1, i1);
renderTimeNano = System.nanoTime() - i;
}
}
示例8: drawSplashScreen
import net.minecraft.client.gui.ScaledResolution; //導入方法依賴的package包/類
private void drawSplashScreen(TextureManager textureManagerInstance) throws LWJGLException {
ScaledResolution scaledresolution = new ScaledResolution(this);
int i = scaledresolution.getScaleFactor();
Framebuffer framebuffer = new Framebuffer(scaledresolution.getScaledWidth() * i,
scaledresolution.getScaledHeight() * i, true);
framebuffer.bindFramebuffer(false);
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double) scaledresolution.getScaledWidth(),
(double) scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GlStateManager.disableLighting();
GlStateManager.disableFog();
GlStateManager.disableDepth();
GlStateManager.enableTexture2D();
InputStream inputstream = null;
try {
inputstream = this.mcDefaultResourcePack.getInputStream(locationMojangPng);
this.mojangLogo = textureManagerInstance.getDynamicTextureLocation("logo",
new DynamicTexture(ImageIO.read(inputstream)));
textureManagerInstance.bindTexture(this.mojangLogo);
} catch (IOException ioexception) {
logger.error((String) ("Unable to load logo: " + locationMojangPng), (Throwable) ioexception);
} finally {
IOUtils.closeQuietly(inputstream);
}
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos(0.0D, (double) this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255)
.endVertex();
worldrenderer.pos((double) this.displayWidth, (double) this.displayHeight, 0.0D).tex(0.0D, 0.0D)
.color(255, 255, 255, 255).endVertex();
worldrenderer.pos((double) this.displayWidth, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
worldrenderer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
tessellator.draw();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
int j = 256;
int k = 256;
this.func_181536_a((scaledresolution.getScaledWidth() - j) / 2, (scaledresolution.getScaledHeight() - k) / 2, 0,
0, j, k, 255, 255, 255, 255);
GlStateManager.disableLighting();
GlStateManager.disableFog();
framebuffer.unbindFramebuffer();
framebuffer.framebufferRender(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i);
GlStateManager.enableAlpha();
GlStateManager.alphaFunc(516, 0.1F);
this.updateDisplay();
}
示例9: drawSplashScreen
import net.minecraft.client.gui.ScaledResolution; //導入方法依賴的package包/類
private void drawSplashScreen(TextureManager textureManagerInstance) throws LWJGLException
{
ScaledResolution scaledresolution = new ScaledResolution(this);
int i = scaledresolution.getScaleFactor();
Framebuffer framebuffer = new Framebuffer(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i, true);
framebuffer.bindFramebuffer(false);
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)scaledresolution.getScaledWidth(), (double)scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GlStateManager.disableLighting();
GlStateManager.disableFog();
GlStateManager.disableDepth();
GlStateManager.enableTexture2D();
InputStream inputstream = null;
try
{
inputstream = this.mcDefaultResourcePack.getInputStream(LOCATION_MOJANG_PNG);
this.mojangLogo = textureManagerInstance.getDynamicTextureLocation("logo", new DynamicTexture(ImageIO.read(inputstream)));
textureManagerInstance.bindTexture(this.mojangLogo);
}
catch (IOException ioexception)
{
LOGGER.error("Unable to load logo: {}", new Object[] {LOCATION_MOJANG_PNG, ioexception});
}
finally
{
IOUtils.closeQuietly(inputstream);
}
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
vertexbuffer.pos(0.0D, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
vertexbuffer.pos((double)this.displayWidth, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
vertexbuffer.pos((double)this.displayWidth, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
vertexbuffer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
tessellator.draw();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
int j = 256;
int k = 256;
this.draw((scaledresolution.getScaledWidth() - 256) / 2, (scaledresolution.getScaledHeight() - 256) / 2, 0, 0, 256, 256, 255, 255, 255, 255);
GlStateManager.disableLighting();
GlStateManager.disableFog();
framebuffer.unbindFramebuffer();
framebuffer.framebufferRender(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i);
GlStateManager.enableAlpha();
GlStateManager.alphaFunc(516, 0.1F);
this.updateDisplay();
}
示例10: showLagometer
import net.minecraft.client.gui.ScaledResolution; //導入方法依賴的package包/類
public static void showLagometer(ScaledResolution p_showLagometer_0_)
{
if (gameSettings != null)
{
if (gameSettings.ofLagometer || gameSettings.showLagometer)
{
long i = System.nanoTime();
GlStateManager.clear(256);
GlStateManager.matrixMode(5889);
GlStateManager.pushMatrix();
GlStateManager.enableColorMaterial();
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)mc.displayWidth, (double)mc.displayHeight, 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GL11.glLineWidth(1.0F);
GlStateManager.disableTexture2D();
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(1, DefaultVertexFormats.POSITION_COLOR);
for (int j = 0; j < timesFrame.length; ++j)
{
int k = (j - numRecordedFrameTimes & timesFrame.length - 1) * 100 / timesFrame.length;
k = k + 155;
float f = (float)mc.displayHeight;
long l = 0L;
if (gcs[j])
{
renderTime(j, timesFrame[j], k, k / 2, 0, f, vertexbuffer);
}
else
{
renderTime(j, timesFrame[j], k, k, k, f, vertexbuffer);
f = f - (float)renderTime(j, timesServer[j], k / 2, k / 2, k / 2, f, vertexbuffer);
f = f - (float)renderTime(j, timesTerrain[j], 0, k, 0, f, vertexbuffer);
f = f - (float)renderTime(j, timesVisibility[j], k, k, 0, f, vertexbuffer);
f = f - (float)renderTime(j, timesChunkUpdate[j], k, 0, 0, f, vertexbuffer);
f = f - (float)renderTime(j, timesChunkUpload[j], k, 0, k, f, vertexbuffer);
f = f - (float)renderTime(j, timesScheduledExecutables[j], 0, 0, k, f, vertexbuffer);
float f2 = f - (float)renderTime(j, timesTick[j], 0, k, k, f, vertexbuffer);
}
}
renderTimeDivider(0, timesFrame.length, 33333333L, 196, 196, 196, (float)mc.displayHeight, vertexbuffer);
renderTimeDivider(0, timesFrame.length, 16666666L, 196, 196, 196, (float)mc.displayHeight, vertexbuffer);
tessellator.draw();
GlStateManager.enableTexture2D();
int j2 = mc.displayHeight - 80;
int k2 = mc.displayHeight - 160;
mc.fontRendererObj.drawString("30", 2, k2 + 1, -8947849);
mc.fontRendererObj.drawString("30", 1, k2, -3881788);
mc.fontRendererObj.drawString("60", 2, j2 + 1, -8947849);
mc.fontRendererObj.drawString("60", 1, j2, -3881788);
GlStateManager.matrixMode(5889);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
float f1 = 1.0F - (float)((double)(System.currentTimeMillis() - memTimeStartMs) / 1000.0D);
f1 = Config.limit(f1, 0.0F, 1.0F);
int l2 = (int)(170.0F + f1 * 85.0F);
int i1 = (int)(100.0F + f1 * 55.0F);
int j1 = (int)(10.0F + f1 * 10.0F);
int k1 = l2 << 16 | i1 << 8 | j1;
int l1 = 512 / p_showLagometer_0_.getScaleFactor() + 2;
int i2 = mc.displayHeight / p_showLagometer_0_.getScaleFactor() - 8;
GuiIngame guiingame = mc.ingameGUI;
GuiIngame.drawRect(l1 - 1, i2 - 1, l1 + 50, i2 + 10, -1605349296);
mc.fontRendererObj.drawString(" " + memMbSec + " MB/s", l1, i2, k1);
renderTimeNano = System.nanoTime() - i;
}
}
}
示例11: drawSplashScreen
import net.minecraft.client.gui.ScaledResolution; //導入方法依賴的package包/類
public void drawSplashScreen(TextureManager textureManagerInstance) throws LWJGLException
{
ScaledResolution scaledresolution = new ScaledResolution(this);
int i = scaledresolution.getScaleFactor();
Framebuffer framebuffer = new Framebuffer(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i, true);
framebuffer.bindFramebuffer(false);
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)scaledresolution.getScaledWidth(), (double)scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GlStateManager.disableLighting();
GlStateManager.disableFog();
GlStateManager.disableDepth();
GlStateManager.enableTexture2D();
InputStream inputstream = null;
try
{
inputstream = this.mcDefaultResourcePack.getInputStream(LOCATION_MOJANG_PNG);
this.mojangLogo = textureManagerInstance.getDynamicTextureLocation("logo", new DynamicTexture(ImageIO.read(inputstream)));
textureManagerInstance.bindTexture(this.mojangLogo);
}
catch (IOException ioexception)
{
LOGGER.error("Unable to load logo: {}", new Object[] {LOCATION_MOJANG_PNG, ioexception});
}
finally
{
IOUtils.closeQuietly(inputstream);
}
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
vertexbuffer.pos(0.0D, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
vertexbuffer.pos((double)this.displayWidth, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
vertexbuffer.pos((double)this.displayWidth, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
vertexbuffer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
tessellator.draw();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
int j = 256;
int k = 256;
this.draw((scaledresolution.getScaledWidth() - 256) / 2, (scaledresolution.getScaledHeight() - 256) / 2, 0, 0, 256, 256, 255, 255, 255, 255);
GlStateManager.disableLighting();
GlStateManager.disableFog();
framebuffer.unbindFramebuffer();
framebuffer.framebufferRender(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i);
GlStateManager.enableAlpha();
GlStateManager.alphaFunc(516, 0.1F);
this.updateDisplay();
}
示例12: drawScreen
import net.minecraft.client.gui.ScaledResolution; //導入方法依賴的package包/類
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawScreen(mouseX, mouseY, partialTicks);
frameCount++;
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(TEXTURE_BACKGROUND);
int x = (this.width - this.xSize) / 2;
int z = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(x, z, 0, 0, this.xSize, this.ySize);
if(renderContext.doesRenderIn3D()) {
if (Mouse.isButtonDown(0) && frameCount > 20) {
renderContext.rotateRender(0.25 * Mouse.getDY(), 0.25 * Mouse.getDX(), 0);
}
} else {
if (Mouse.isButtonDown(0) && frameCount > 20) {
renderContext.moveRender(0.25 * Mouse.getDX(), 0, -0.25 * Mouse.getDY());
}
}
int dwheel = Mouse.getDWheel();
if(dwheel < 0) {
renderContext.zoomOut();
} else if(dwheel > 0) {
renderContext.zoomIn();
}
if(GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak)) {
if(renderContext.getShiftSnap() == -1) {
renderContext.snapSamples();
}
} else {
renderContext.releaseSamples();
}
ScaledResolution res = new ScaledResolution(mc);
Rectangle scissorFrame = new Rectangle((guiLeft + 8) * res.getScaleFactor(), (guiTop + 43) * res.getScaleFactor(),
160 * res.getScaleFactor(), 94 * res.getScaleFactor());
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glScissor(scissorFrame.x, scissorFrame.y, scissorFrame.width, scissorFrame.height);
x = 88;
z = 66;
renderContext.renderAt(this.guiLeft + x, this.guiTop + z, partialTicks);
GL11.glDisable(GL11.GL_SCISSOR_TEST);
drawButtons(mouseX, mouseY);
GlStateManager.disableDepth();
fontRenderer.drawStringWithShadow(machine.getLocalizedName(), this.guiLeft + 10, this.guiTop + 11, 0xFFFFFFFF);
if(machine.requiresBlueprint()) {
String reqBlueprint = I18n.format("tooltip.machinery.blueprint.required");
fontRenderer.drawString(reqBlueprint, this.guiLeft + 10, this.guiTop + 106, 0x444444);
}
GlStateManager.enableDepth();
scissorFrame = new Rectangle(MathHelper.floor(this.guiLeft + 8), MathHelper.floor(this.guiTop + 8), 160, 94);
if(!renderContext.doesRenderIn3D() && scissorFrame.contains(mouseX, mouseY)) {
render2DHover(mouseX, mouseY, x, z);
}
}