I'm trying to create a custom Arrow which moves along with the mouse. I've tried repositioning according to X/Y of mouse but it screws up completely with offsets.
Its fine close to top left, but gets distorted further bottom right you go.
Does anyone have a solution for this? (see Screenshots and I attached map)
The issue is that the sc2 ui is 1600 based, so if your resolution is wider than that the mouse position reference begins to deviate, I devised a work around at one point but it'll be a bit before I can post it (typing from my phone right now). Essentially though I create a mesh of 1x2800 and 2800x1 dialog buttons and use them to detect the stretch ratio of the player's ui
The problem is because the game cursor position is returned in a 4:3 space of 1600*1200. This space is kept probably for limiting the domain of inputs (you can always expect players to produce x of 0-1599 and y of 0-1199). In reality this space is stretched and distorted which however no one really cares as it is not used to display anything.
Screen space used to position UI elements also uses the same 1600*1200 space range base for convenience. However to prevent displayed content becoming distorted (incorrect aspect ratio, a square would look like a rectangle which is bad) the actual range provided undergoes aspect ratio correction. This is always constructive, meaning it will extend the display area (not crop) so it is the correct aspect ratio. As far as developers should be concerned anything inside 1600*1200 is always guaranteed to be visible no matter the aspect ratio of the client display. Anything beyond that is aspect ratio dependent space so should not be used to avoid out of bounds UI elements.
This is all fine and well until people want a UI element to follow the cursor. The differences in spaces between input and output and inability to get a client's resolution or even have a native which will perform aspect ratio correction automatically causes this big problem.
I have observed the following behaviour...
All 4*3 ratio resolutions (big and small) map input to output space 1:1, the above problem does not apply to them at all as they do not need aspect ratio correction.
Narrow screen ratio resolution (eg 5*4) will extend the UI area vertically (bigger y). The X axis will map from input to output perfectly.
Wide screen ratio resolutions (eg 8*5) will extend the UI area horizontally (bigger x). The Y axis will map from input to output perfectly.
In theory all that is required is to either automatically detect aspect ratio (preferred) or allow the user to configure it. I will run more tests tomorrow on this to see what can be done.
After testing I can confirm that it is completely display aspect ratio related. If you know the display aspect ratio you can apply a correction.
I am not sure but people have hinted that buttons can be used to obtain a ratio approximation. Additionally it would appear that LotV is adding a new dialog item property that allows you to disable aspect ratio correction.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm trying to create a custom Arrow which moves along with the mouse. I've tried repositioning according to X/Y of mouse but it screws up completely with offsets.
Its fine close to top left, but gets distorted further bottom right you go.
Does anyone have a solution for this? (see Screenshots and I attached map)
Ok I've played around, If I use base resolution 1024x768 then offset works fine.
Any other resolutions there's major distortion in the X or Y, it's impossible to get the arrow to stay on the mouse.
Is there any way to get around this?
The issue is that the sc2 ui is 1600 based, so if your resolution is wider than that the mouse position reference begins to deviate, I devised a work around at one point but it'll be a bit before I can post it (typing from my phone right now). Essentially though I create a mesh of 1x2800 and 2800x1 dialog buttons and use them to detect the stretch ratio of the player's ui
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
Thanks, I got it working, angle changes as well, although only on minimal resolution.
kk, no need for anything that allows you to use full res?
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
Still need it for ALL resolutions! Any help greatly appreciated.
The problem is because the game cursor position is returned in a 4:3 space of 1600*1200. This space is kept probably for limiting the domain of inputs (you can always expect players to produce x of 0-1599 and y of 0-1199). In reality this space is stretched and distorted which however no one really cares as it is not used to display anything.
Screen space used to position UI elements also uses the same 1600*1200 space range base for convenience. However to prevent displayed content becoming distorted (incorrect aspect ratio, a square would look like a rectangle which is bad) the actual range provided undergoes aspect ratio correction. This is always constructive, meaning it will extend the display area (not crop) so it is the correct aspect ratio. As far as developers should be concerned anything inside 1600*1200 is always guaranteed to be visible no matter the aspect ratio of the client display. Anything beyond that is aspect ratio dependent space so should not be used to avoid out of bounds UI elements.
This is all fine and well until people want a UI element to follow the cursor. The differences in spaces between input and output and inability to get a client's resolution or even have a native which will perform aspect ratio correction automatically causes this big problem.
I have observed the following behaviour...
In theory all that is required is to either automatically detect aspect ratio (preferred) or allow the user to configure it. I will run more tests tomorrow on this to see what can be done.
After testing I can confirm that it is completely display aspect ratio related. If you know the display aspect ratio you can apply a correction.
Awesome, thanks so much.
Whats the easiest way to detect Aspect Ratio per user then?
I am not sure but people have hinted that buttons can be used to obtain a ratio approximation. Additionally it would appear that LotV is adding a new dialog item property that allows you to disable aspect ratio correction.