I have set a dialog to full screen and then made a dialog item image inside of it and then i made a trigger that check when i move mouse and then have the image following the mouse. All that sounds ok BUT it follow it very weird.
When i have the mouse up to the left then the picture is in perfect position but when i move the mouse to the right then its like its lagging behind in portion to how far the mouse is the the right.
If i set the game to run in full screen the distance become a bit less and if i set it in window mode and make the game window small then it follow it perfect.
Edit: Found the main problem. I did some debugging and did track my mouse by printing the x location it was at. I'm running at 1920 resolution but when my mouse was the the right edge of screen it said 1599 meaning 221 pixels are missing but the strange part is that the image that follow the mouse are at the correct location, on the x axis at 1599 but my mouse are in fact at 1920. I'm so confused :(
Mouse position in the UI is NOT the same as the UI location.
Any solution to this?
Update: Ok i found something that might be able to help me with my problem
I'd guess your using the mouse position based in the world not in the ui as it should be. Far as i know there is no way to grab the players resolution without them inputting/selecting it themselves
I think I suggested this before, but I would recommend you ask the player what his resolution is the first time he plays the game, then store his answer in a bank. From there, adjust the position of the following image based on the player's resolution. The bank would be useful for avoiding the intrusive dialog every game.
For example, you would move the image to "Position of mouse * offset" where offset is the proportion by which the image is in error. For a resolution of 1920, this proportion offset would be ( 1920 / 1600 = 1.2 ) so when the players mouse X is at 1920, the position of the image is moved to 1600 * 1.2 (which equals 1920.)
I imagine the other resolutions would be done in the same way. You first need to calculate the offset by dividing (X resolution / 1600.) Then multiply that offset by the current position of the image.
Rather than using the "set dialog to full screen" why not just make a separate dialog box with button clicks disabled on it, and no background or borders (invisible) which is say, 2400X1200 (Large enough to cover any resolution) offset by -75, -75 (so it matches up evenly on the top and left of the screen).
Now, you can base the movement of your dialog image on this dialog; and it should work as intended.
You may also be able to simply make the resolution of your existing dialog 2400X1200, and do the same thing. I was/am not sure how you hookup all of the other UI elements to it though; you may have to rework them to fit better for various resolutions. I think it would be easier just to make and use a second; invisible dialog to drag inventory items like such.
I have set a dialog to full screen and then made a dialog item image inside of it and then i made a trigger that check when i move mouse and then have the image following the mouse. All that sounds ok BUT it follow it very weird.
When i have the mouse up to the left then the picture is in perfect position but when i move the mouse to the right then its like its lagging behind in portion to how far the mouse is the the right.
If i set the game to run in full screen the distance become a bit less and if i set it in window mode and make the game window small then it follow it perfect.
Edit: Found the main problem. I did some debugging and did track my mouse by printing the x location it was at. I'm running at 1920 resolution but when my mouse was the the right edge of screen it said 1599 meaning 221 pixels are missing but the strange part is that the image that follow the mouse are at the correct location, on the x axis at 1599 but my mouse are in fact at 1920. I'm so confused :(
Mouse position in the UI is NOT the same as the UI location.
Any solution to this?
Update: Ok i found something that might be able to help me with my problem
http://www.sc2mapster.com/forums/resources/tutorials/16364-trigger-how-to-find-actual-size-of-a-dialog-in-game/#p1
Now i just need to find out how to check what resolution the user is running, no clue at all how to find that with triggers, anybody who know?
@Sherlia: Go
I'd guess your using the mouse position based in the world not in the ui as it should be. Far as i know there is no way to grab the players resolution without them inputting/selecting it themselves
I think I suggested this before, but I would recommend you ask the player what his resolution is the first time he plays the game, then store his answer in a bank. From there, adjust the position of the following image based on the player's resolution. The bank would be useful for avoiding the intrusive dialog every game.
For example, you would move the image to "Position of mouse * offset" where offset is the proportion by which the image is in error. For a resolution of 1920, this proportion offset would be ( 1920 / 1600 = 1.2 ) so when the players mouse X is at 1920, the position of the image is moved to 1600 * 1.2 (which equals 1920.)
I imagine the other resolutions would be done in the same way. You first need to calculate the offset by dividing (X resolution / 1600.) Then multiply that offset by the current position of the image.
I have a solution for you!
Rather than using the "set dialog to full screen" why not just make a separate dialog box with button clicks disabled on it, and no background or borders (invisible) which is say, 2400X1200 (Large enough to cover any resolution) offset by -75, -75 (so it matches up evenly on the top and left of the screen).
Now, you can base the movement of your dialog image on this dialog; and it should work as intended.
You may also be able to simply make the resolution of your existing dialog 2400X1200, and do the same thing. I was/am not sure how you hookup all of the other UI elements to it though; you may have to rework them to fit better for various resolutions. I think it would be easier just to make and use a second; invisible dialog to drag inventory items like such.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418