Jump to content

Changing cursor?


GodOfYeti

Recommended Posts

Just want to reassure - cursor or crosshair?

 

Crosshair is derived from Gui.icons (texturepack) and rendered using GuiIngame (you can cancel it with events).

 

As to cursor - that's strictly Java stuff and operating on Frame stuff. You would need to edit something at very-beggining of launching client.

Since windows-cursor is rendered over the application using events to render custom cursor will leave you with 2 cursors on top of each other (windows one on top). I guess you could try accessing it somehow during game rendering, but I have no idea how you would do it smart way (mainly because I don't know what MC uses to build program frame).

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Hi

 

The RenderGameOverlayEvent.Pre is your friend.

 

  /**
   * Draw the custom crosshairs if reqd
   * Otherwise, cancel the event so that the normal crosshair is drawn.
   * @param event
   */
  @SubscribeEvent
  public void renderOverlayPre(RenderGameOverlayEvent.Pre event) {

    if (event.type == RenderGameOverlayEvent.ElementType.CROSSHAIRS) {
      ClientSide.speedyToolRenderers.render(renderGameOverlayCrosshairsEvent, event.partialTicks);
      event.setCanceled(renderGameOverlayCrosshairsEvent.isCanceled());
    } 

    return;
  }

 

You will also need to know -

- how to subscribe your eventhandler to the event bus, 

http://www.wuppy29.com/minecraft/modding-tutorials/wuppys-minecraft-forge-modding-tutorials-for-1-7-events

and how to use OpenGL to draw your custom cursor directly to the screen.  (This is trickier.  The fragment below might give you some clues.  Let us know if you need more guidance.)

 

-TGG

 

ScaledResolution scaledResolution = event.resolution;

    int width = scaledResolution.getScaledWidth();
    int height = scaledResolution.getScaledHeight();
    final float Z_LEVEL_FROM_GUI_IN_GAME_FORGE = -90.0F;            // taken from GuiInGameForge.renderCrossHairs
    final double CROSSHAIR_ICON_WIDTH = 88;
    final double CROSSHAIR_ICON_HEIGHT = 88;
    final double CROSSHAIR_ICON_RADIUS = 40;
    final double CROSSHAIR_X_OFFSET = -CROSSHAIR_ICON_WIDTH / 2.0;
    final double CROSSHAIR_Y_OFFSET = -CROSSHAIR_ICON_HEIGHT / 2.0;

    try {
      GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
      GL11.glEnable(GL11.GL_BLEND);
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

      GL11.glColor3d(lineColour.R * ringColourIntensity, lineColour.G * ringColourIntensity, lineColour.B * ringColourIntensity);

      Minecraft.getMinecraft().renderEngine.bindTexture(ringTexture);
      GL11.glPushMatrix();
      GL11.glTranslatef(width / 2, height / 2, Z_LEVEL_FROM_GUI_IN_GAME_FORGE);
      drawTexturedRectangle(CROSSHAIR_X_OFFSET * starSize * ringSize, CROSSHAIR_Y_OFFSET * starSize * ringSize, Z_LEVEL_FROM_GUI_IN_GAME_FORGE,
                            CROSSHAIR_ICON_WIDTH * starSize * ringSize, CROSSHAIR_ICON_HEIGHT * starSize * ringSize);
      GL11.glPopMatrix();

      GL11.glColor3d(lineColour.R * starColourIntensity, lineColour.G * starColourIntensity, lineColour.B * starColourIntensity);
      Minecraft.getMinecraft().renderEngine.bindTexture(octoStarTexture);
      GL11.glPushMatrix();
      GL11.glTranslatef(width / 2, height / 2, Z_LEVEL_FROM_GUI_IN_GAME_FORGE);
      GL11.glRotated( (clockwiseRotation ? degreesOfRotation : - degreesOfRotation),
                     0, 0, 1.0F);
      drawTexturedRectangle(CROSSHAIR_X_OFFSET * starSize, CROSSHAIR_Y_OFFSET * starSize, Z_LEVEL_FROM_GUI_IN_GAME_FORGE,
                            CROSSHAIR_ICON_WIDTH * starSize, CROSSHAIR_ICON_HEIGHT * starSize);
      GL11.glPopMatrix();

      final float ARC_LINE_WIDTH = 4.0F;

      if (drawTaskCompletionRing) {
        double progressBarIntensity = RING_COLOUR_MAX_INTENSITY;

        GL11.glColor3d(lineColour.R * progressBarIntensity, lineColour.G * progressBarIntensity, lineColour.B * progressBarIntensity);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glPushMatrix();
        GL11.glLineWidth(ARC_LINE_WIDTH);
        GL11.glTranslatef(width / 2, height / 2, Z_LEVEL_FROM_GUI_IN_GAME_FORGE);
        drawArc(CROSSHAIR_ICON_RADIUS * ringSize, 0.0,
                clockwiseRotation ? taskCompletionRingAngle : 360.0 - taskCompletionRingAngle,
                0.0
               );
        GL11.glPopMatrix();
      }
    } finally {
      GL11.glPopAttrib();
    }

and

  /**
   * Draws a textured rectangle at the given z-value, using the entire texture. Args: x, y, z, width, height
   */
  private void drawTexturedRectangle(double x, double y, double z, double width, double height)
  {
    double ICON_MIN_U = 0.0;
    double ICON_MAX_U = 1.0;
    double ICON_MIN_V = 0.0;
    double ICON_MAX_V = 1.0;
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(    x + 0, y + height, z,  ICON_MIN_U, ICON_MAX_V);
    tessellator.addVertexWithUV(x + width, y + height, z,  ICON_MAX_U, ICON_MAX_V);
    tessellator.addVertexWithUV(x + width,      y + 0, z,  ICON_MAX_U, ICON_MIN_V);
    tessellator.addVertexWithUV(    x + 0,      y + 0, z,  ICON_MIN_U, ICON_MIN_V);
    tessellator.draw();
  }

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
    • OLXTOTO adalah situs bandar togel online resmi terbesar dan terpercaya di Indonesia. Bergabunglah dengan OLXTOTO dan nikmati pengalaman bermain togel yang aman dan terjamin. Koleksi toto 4D dan togel toto terlengkap di OLXTOTO membuat para member memiliki pilihan taruhan yang lebih banyak. Sebagai situs togel terpercaya, OLXTOTO menjaga keamanan dan kenyamanan para membernya dengan sistem keamanan terbaik dan enkripsi data. Transaksi yang cepat, aman, dan terpercaya merupakan jaminan dari OLXTOTO. Nikmati layanan situs toto terbaik dari OLXTOTO dengan tampilan yang user-friendly dan mudah digunakan. Layanan pelanggan tersedia 24/7 untuk membantu para member. Bergabunglah dengan OLXTOTO sekarang untuk merasakan pengalaman bermain togel yang menyenangkan dan menguntungkan.
    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.