Package net.minecraft.client.gui

Examples of net.minecraft.client.gui.ScaledResolution


  @SubscribeEvent
  @SideOnly(Side.CLIENT)
  public void drawDislocationFocusHUD(RenderGameOverlayEvent.Post event) {
    if (event.type == ElementType.ALL && tooltipDisplayTicks > 0 && !MathHelper.stringNullOrLengthZero(currentTooltip)) {
      Minecraft mc = Minecraft.getMinecraft();
      ScaledResolution var5 = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
      int var6 = var5.getScaledWidth();
      int var7 = var5.getScaledHeight();
      FontRenderer var8 = mc.fontRenderer;

      int tooltipStartX = (var6 - var8.getStringWidth(currentTooltip)) / 2;
      int tooltipStartY = var7 - 72;
View Full Code Here


  @Override
  public void updateScreen() {
    ++ticks;

    ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
    int i = res.getScaledWidth();
    int j = res.getScaledHeight();
    int mx = Mouse.getX() * i / mc.displayWidth;
    int my = j - Mouse.getY() * j / mc.displayHeight - 1;

    if (Mouse.isButtonDown(0)) {
      int deltaX = mx - lastMouseX;
View Full Code Here

    clampScrollToBounds();

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_FOG);

    ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
    int sx = minX * sr.getScaleFactor();
    int sw = width * sr.getScaleFactor();
    int sy = mc.displayHeight - (maxY * sr.getScaleFactor());
    int sh = height * sr.getScaleFactor();
    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    GL11.glScissor(sx, sy, sw, sh);

    Tessellator tessellator = Tessellator.instance;
    drawContainerBackground(tessellator);
View Full Code Here

    if(equippedProbe.getItemDamage() == 0) {
      icon = IconEIO.PROBE_OVERLAY_PROBE;
    } else {
      icon = IconEIO.PROBE_OVERLAY_COPY;
    }
    ScaledResolution res = event.resolution;

    double offsetX = 16;
    double offsetY = res.getScaledHeight() - 16;
    GL11.glColor4f(1, 1, 1, 0.75f);
    icon.renderIcon(offsetX, offsetY - 32, 64, 32, 0, true);
  }
View Full Code Here

  @Override
  public void draw(int mouseX, int mouseY, float partialTick) {

    RenderUtil.renderQuad2D(bounds.x, bounds.y, 0, bounds.width, bounds.height, ColorUtil.getRGB(Color.black));
    Minecraft mc = Minecraft.getMinecraft();
    ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);

    int vpx = ( (screen.getGuiLeft() + bounds.x - screen.getOverlayOffsetX())* scaledresolution.getScaleFactor());
    int vpy = (screen.getGuiTop() + 4) * scaledresolution.getScaleFactor();
    int w = bounds.width * scaledresolution.getScaleFactor();
    int h = bounds.height * scaledresolution.getScaleFactor();

    renderer.drawScreen(mouseX, mouseY, partialTick, new Rectangle(vpx,vpy,w,h), bounds);

  }
View Full Code Here

  }

  private void renderOverlay(int mx, int my) {
    Rectangle vp = camera.getViewport();
    ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);

    int vpx = vp.x / scaledresolution.getScaleFactor();
    int vph = vp.height / scaledresolution.getScaleFactor();
    int vpw = vp.width/ scaledresolution.getScaleFactor();
    int vpy = (int)((float)(vp.y + vp.height - 4)/(float)scaledresolution.getScaleFactor());

    GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glTranslatef(vpx, vpy, -2000.0F);

    GL11.glDisable(GL11.GL_LIGHTING);

    int x = vpw - 16;
    int y = vph - 16;

    mx -= vpx;
    my -= vpy;
    if(mx >= x && mx <= x + IconEIO.IO_WHATSIT.width &&
        my >= y && my <= y + IconEIO.IO_WHATSIT.height) {
      RenderUtil.renderQuad2D(x, y, 0, IconEIO.IO_WHATSIT.width, IconEIO.IO_WHATSIT.height, new Vector4f(0.4f,0.4f,0.4f,0.6f));
      inNeigButBounds = true;
    } else {
      inNeigButBounds = false;
    }

    GL11.glColor3f(1, 1, 1);
    IconEIO.IO_WHATSIT.renderIcon(x, y, true);


    if(selection != null) {
      IconEIO ioIcon = null;
      //    INPUT
      IoMode mode = selection.config.getIoMode(selection.face);
      if(mode == IoMode.PULL) {
        ioIcon = IconEIO.INPUT_SMALL_INV;
      } else if(mode == IoMode.PUSH) {
        ioIcon = IconEIO.OUTPUT_SMALL_INV;
      } else if(mode == IoMode.PUSH_PULL) {
        ioIcon = IconEIO.INPUT_OUTPUT;
      } else if(mode == IoMode.DISABLED) {
        ioIcon = IconEIO.DISABLED;
      }

      y = vph - mc.fontRenderer.FONT_HEIGHT - 2;
      mc.fontRenderer.drawString(getLabelForMode(mode), 4, y, ColorUtil.getRGB(Color.white));
      if(ioIcon != null) {
        int w = mc.fontRenderer.getStringWidth(mode.getLocalisedName());
        double xd = (w - ioIcon.width)/2;
        xd = Math.max(0, w);
        xd /=2;
        xd += 4;
        xd /= scaledresolution.getScaleFactor();
        ioIcon.renderIcon(xd, y - mc.fontRenderer.FONT_HEIGHT - 2,true);
      }
    }
  }
View Full Code Here

    }

  }

  private boolean updateCamera(float partialTick) {
    ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
    int vpx = guiLeft * scaledresolution.getScaleFactor();
    int vpy = guiTop * scaledresolution.getScaleFactor();
    int vpw = (int) ((float) gw / width * mc.displayWidth);
    int vph = (int) ((float) gh / height * mc.displayHeight);
    if(vpw <= 0 || vph <= 0) {
      return false;
    }
View Full Code Here

  }

  private float portalFade = 1;

  private void drawEffectOverlay(float partialTick) {
    ScaledResolution scaledresolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDepthMask(false);

    RenderHelper.disableStandardItemLighting();
    RenderHelper.enableGUIStandardItemLighting();

    GL11.glDisable(GL11.GL_LIGHTING);
    mc.entityRenderer.disableLightmap(0);

    portalFade -= (partialTick * (1f / animationDuration));
    portalFade = Math.max(0, portalFade);
    if(portalFade >= 0) {
      drawRect(scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight(), 0, 0.3f, 0.16f, Math.max(0.3f, portalFade));
    }

    GL11.glEnable(GL11.GL_LIGHTING);
    mc.entityRenderer.enableLightmap(0);

    renderPortalOverlay(0.8f - (0.2f * (1 - portalFade)), scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight());

    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
View Full Code Here

      default:
        break;
      }

      Minecraft mc = Minecraft.getMinecraft();
      ScaledResolution scaledresolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);

      int mouseX = Mouse.getX() * scaledresolution.getScaledWidth() / mc.displayWidth;
      int mouseY = scaledresolution.getScaledHeight() - Mouse.getY() * scaledresolution.getScaledHeight() / mc.displayHeight - 1;

      if (mouseX >= xPosition && mouseX <= xPosition + width && mouseY >= yPosition && mouseY <= yPosition + height)
      {
        List<String> description = new ArrayList<String>();
        description.add(StatCollector.translateToLocal("tooltip.fluidmode"));
View Full Code Here

      {
        description.add(EnumChatFormatting.GRAY + current);
      }
     
      Minecraft mc = Minecraft.getMinecraft();
      ScaledResolution scaledresolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);

      int mouseX = Mouse.getX() * scaledresolution.getScaledWidth() / mc.displayWidth;
      int mouseY = scaledresolution.getScaledHeight() - Mouse.getY() * scaledresolution.getScaledHeight() / mc.displayHeight - 1;

      if (mouseX >= xPosition && mouseX <= xPosition + width && mouseY >= yPosition && mouseY <= yPosition + height)
      {
        drawHoveringText(description, mouseX, mouseY, mc.fontRenderer);
      }
View Full Code Here

TOP

Related Classes of net.minecraft.client.gui.ScaledResolution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.