Jump to content

Recommended Posts

Posted

I am making a new kind of GUI in minecraft, it is the gui of a laptop and it is meant to simulate windows 7 as much as possible, but with out the clunky MC built in buttons, but instead, I have the background dynamically changing while the player clicks the screen(so if its between point x,y,z, and w, its on the icon for the web application, switch to that screen), but, the GUI texture is slightly dependent on the dmenisions of the game screen(so the HD texture can fit in smaller screens), is there a way to calculate the position of the mouse when clicked, on the texture? like taking the expression from the drawGuicontianerBackground() method((this.width - xSize)/2), and somehow use that to calclate position on the texture, like 0,0 being in the top left corner of the texture, not the screen. Like maybe for texture posistion 50,50,

   if(((this.width - xSize)/2 + 50) == mouseX && (this.height - ySize)/2 + 50) == mouseY)
   {
       this.party();
   }

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Posted

Hi

 

It sounds like you just need to be able to convert your mouseClicked coordinate back into the texture coordinate?

 

texture_x = mouseclick_x * texture_width / this.width;

texture_y = mouseclick_y * texture_height / this.height;

 

You know texture_width and texture_height because you're supplying the texture, yes?

 

-TGG

Posted

Yes. However the texture does change size depending on screen size, in order to fit. But since i update the xSize and ySize varaibles when scaling, it should be fine unless the player clicks in the first tick.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

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



×
×
  • Create New...

Important Information

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