Posted April 17, 201411 yr 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]
April 17, 201411 yr 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
April 17, 201411 yr Author 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.