Jump to content
  • Advertisement

asm_2_hex

Member
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

100 Neutral

About asm_2_hex

  • Rank
    Newbie
  1. asm_2_hex

    Moving GUI by mouse.

    Quote:Original post by szecs I suggest you to use delta values: Calculate the mouse deltas: dx = MouseX-PrevMouseX; dy = MouseY-PrevMouseY; PrevMouseX = MouseX; PrevMouseY = MouseY; PositionOfGui_x += dx; PositionOfGui_y += dy;I use that, and I hope you asked that. The problem with that is, that my menu positions are predefined. Meaning if my menu Y Axis is 100. And my cursor's Y axis is at 110; It would simply add that to the predefined value of 100.0f. Simply telling it to equal ether dx or dy ends up jumping upwards. Quote: Original post by jtagge75 Look up GetCursorPos() and ScreenToClient() then subtract the GUI item position from that mouse position and it will give you the offset. Thats the x and y values to add to the mouse position when moving the mouse. If you are using the upper left of your GUI items that number will be negative. If you think about it the upper left should be to the left and up of the mouse cursor (ie smaller numbers then the actual mouse position). As I said before, it adds values to the Y or X axis of the menu that seem to distort it from where I'd like to place it. Right now, I'm just simply so confused. This seems almost like a open and shut case, yet every time I attempt to move a menu by it's title bar. It just doesn't want to position it self in the correct position.
  2. asm_2_hex

    Moving GUI by mouse.

    This is where I'm having the trouble at. I can't seem to figure out a good clean way of calculating the correct position. Every method I attempt, fails quite badly.
  3. asm_2_hex

    Moving GUI by mouse.

    Hello GD, So for the past few days, I've been working on a GUI in directX, how ever I seem to have come across a snag that I can't seem to figure out. You see my problem is moving the GUI by mouse. But it's not just moving the GUI that's the issue, it's the fact that when I attempt to move the GUI, the GUI as a whole quickly snaps to where my cursor position is. Meaning if I where to click on the title bar of the GUI some where with in the middle, and then try to move it from that middle position. It would simply as I said before snap to the left of my cursor or in other words the X Axis of the menu would be exactly where my cursor position is. That or it would move uncontrollably. So in part what I'm looking for, is a easy way to keep both the menu and cursor coordinates in the correct area while I move my menu. Similar to when you move your Internet browser window. The browser it self don't instantly move to the left of your mouse, instead it stays where it was originally click on. And doesn't suddenly snap to exactly where the mouse is located. Thanks, -A2H
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!