I don't know if this has been posted before, but in case others have been wondering how to do this, here is what I found.
Basically, for both X and Y, take the mouse clicked pos, multiply it by 1200, and divide by the players current screen resolution height.
Then a dialog can be placed at those coordinates, relative to topLeft.
I don't know why blizzard decided that was the right way to do it, but it works for me.
Edit:
And after posting this I read what this forum is actually about..
All about development of UI through the use of SC2Layout files.
Feel free to move it as needed..
Could you perhaps make a bit more tutorial like post about this in the Tutorial section of the forums?
That way if people are wondering about it they can simply look up your tutorial and find exactly how to do it.
No, it doesn't require that.. All it requires is that he clicks somewhere, where the mouse down event can register it.
The screen does flicker when it tests his resolution though, and it has a validation phase after it has measured the resolution. I modified it to skip that validation, since I found that it sometimes would keep remeasuring the resolution because it never got satisfied.
But keep in mind that it can measure the wrong resolution if the user doesn't keep the mouse still when he clicks. So if you skip the validation, you should probably add some way for the user to tell it to remeasure the resolution.
I don't know if this has been posted before, but in case others have been wondering how to do this, here is what I found.
Basically, for both X and Y, take the mouse clicked pos, multiply it by 1200, and divide by the players current screen resolution height.
Then a dialog can be placed at those coordinates, relative to topLeft.
To get the players resolution, this library can be used.
http://www.sc2mapster.com/forums/resources/trigger-libraries/17101-library-get-resolution/
I don't know why blizzard decided that was the right way to do it, but it works for me.
Edit:
And after posting this I read what this forum is actually about..
All about development of UI through the use of SC2Layout files.
Feel free to move it as needed..
@SBeier: Go
I'll leave it here for now.
Could you perhaps make a bit more tutorial like post about this in the Tutorial section of the forums? That way if people are wondering about it they can simply look up your tutorial and find exactly how to do it.
Don't know if I want to make a proper tutorial with examples about it.. That would probably require that I made it in GUI or something : /
Wait does this mean you could make a dialog follow the mouse? Mouse moved events?
@OneTwoSC: Go
Yes, I've done it, how else would you do pick up and drop dialog?
@grenegg: Go
I didn't think we could. There was no way to get UI position XY. Can you explain the math to me again?
@OneTwoSC: Go
http://www.sc2mapster.com/forums/resources/tutorials/24121-triggering-example-map/#p1
Its in there
NOTE: The library provides me the two resolutions, but using the method up top works.
@OneTwoSC: Go
Use the get resolution library I linked above. Then make sure to call
for all your players. Once they clicked anywhere, their resolution can be fetched from
When you then run a trigger on mouse down/up, you can get the coords with
Or if you do it on mouse move,
@SBeier: Go
Cool Thanks. And nice, that library doesn't require the user to be asked like we had to in the past? If so... GOOOOD!
No, it doesn't require that.. All it requires is that he clicks somewhere, where the mouse down event can register it.
The screen does flicker when it tests his resolution though, and it has a validation phase after it has measured the resolution. I modified it to skip that validation, since I found that it sometimes would keep remeasuring the resolution because it never got satisfied.
But keep in mind that it can measure the wrong resolution if the user doesn't keep the mouse still when he clicks. So if you skip the validation, you should probably add some way for the user to tell it to remeasure the resolution.