Thread Tools Display Modes
11-17-10, 06:41 AM   #1
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Unitframe position on lower resolution

Hello. I'm having a few problems getting the UFs in my UI to be positioned properly on lower resolutions. With the UI scaling change I've been able to try out how the UFs look effectively on a lower resolution.

This is what it looks like normally:



Lower resolution:



Code:
	spawnHelper(self, 'focus', "BOTTOMLEFT", UIParent, "BOTTOMLEFT", 566, 447)
	spawnHelper(self, 'pet', "BOTTOMLEFT", UIParent, "BOTTOMLEFT", 450, 447)
	spawnHelper(self, 'player', "BOTTOMLEFT", UIParent, "BOTTOMLEFT", 450, 420)
	spawnHelper(self, 'target', "TOP", UIParent, "BOTTOM", 0, 300)
I've tried letting the position scale with screen height and width, like this, but that didn't work either:

Code:
	spawnHelper(self, 'focus', "BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0.33690 * GetScreenWidth(), 0.42571 * GetScreenHeight())
	spawnHelper(self, 'pet', "BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0.26785 * GetScreenWidth(), 0.42571 * GetScreenHeight())
	spawnHelper(self, 'player', "BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0.26785 * GetScreenWidth(), .4 * GetScreenHeight())
	spawnHelper(self, 'target', "TOP", UIParent, "BOTTOM", 0, 0.28571 * GetScreenHeight())
What would be the most simple way to sort this out?

Last edited by Haleth : 11-17-10 at 06:56 AM. Reason: typo
  Reply With Quote
11-17-10, 06:49 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Always use center positions if you can. (BOTTOM,LEFT,RIGHT,TOP,CENTER)

My tip would be to anchor your actionbars and your unitframes from BOTTOM.

Basically change BOTTOMLEFT to BOTTOM and adjust x and y values.

Use BOTTOMLEFT,TOPRIGHT,BOTTOMRIGHT,TOPLEFT only if you want a frame to be strictly in the edge.

Code:
	spawnHelper(self, 'focus', "LEFT", UIParent, 20, 30)
	spawnHelper(self, 'pet', "LEFT", UIParent, 20, -30)
	spawnHelper(self, 'player', "BOTTOM", UIParent, 0, 200)
	spawnHelper(self, 'target', "BOTTOM", UIParent, -200, 300)
Read: http://wowprogramming.com/docs/widgets/Region/SetPoint
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 11-17-10 at 06:54 AM.
  Reply With Quote
11-17-10, 07:09 AM   #3
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Alright, did some changes now. It's looking better, but target is still a bit of a problem.

With this code:

Code:
	spawnHelper(self, 'player', "BOTTOM", UIParent, "CENTER", -275, -105)
	spawnHelper(self, 'target', "TOP", UIParent, "BOTTOM", 0, 300)
	spawnHelper(self, 'focus', "BOTTOMRIGHT", oUF_FreePlayer, "TOPRIGHT", 0, 12)
	spawnHelper(self, 'pet', "BOTTOMLEFT", oUF_FreePlayer, "TOPLEFT", 0, 12)
It looks like this (too close to the player frame):



But with this code:

Code:
	spawnHelper(self, 'player', "BOTTOM", UIParent, "CENTER", -275, -105)
	spawnHelper(self, 'target', "TOP", UIParent, "CENTER", 0, -225)
	spawnHelper(self, 'focus', "BOTTOMRIGHT", oUF_FreePlayer, "TOPRIGHT", 0, 12)
	spawnHelper(self, 'pet', "BOTTOMLEFT", oUF_FreePlayer, "TOPLEFT", 0, 12)
It looks like this (too close to the action bars):



I guess this is inevitable when playing on a lower resolution.

Last edited by Haleth : 11-17-10 at 07:18 AM.
  Reply With Quote
11-17-10, 08:19 AM   #4
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Why have player and target different setpoint anchors?

Code:
	spawnHelper(self, 'player', "BOTTOM", UIParent, "BOTTOM", -275, 300)
	spawnHelper(self, 'target', "BOTTOM", UIParent, "BOTTOM", 0, 200)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 11-17-10 at 08:24 AM.
  Reply With Quote
11-17-10, 08:45 AM   #5
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Since your target is in a rather central position, anchor units in relation to it.

target > bottom, uiparent, x, y
player > topright, target, topleft, x, y
etc.

You did the same with pet and focus, just anchored to player.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
11-17-10, 11:46 AM   #6
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
I tried both of your suggestions and I ended up with something similar to what I showed in my last screenshot. Of course because it's on a lower resolution the target frame will be relatively closer either to the center of the screen or the action bars.

Thanks for the help.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Unitframe position on lower resolution


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off