Thread Tools Display Modes
07-14-13, 12:13 PM   #1
Brusalk
An Aku'mai Servant
 
Brusalk's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 32
Stereoscopic 3D - Get Mouse Icon Depth or Adjust Global UI Depth?

When running in Steroscopic 3D mode with the mouse in software mode the mouse will auto-adjust it's depth to the depth of what it's over in the game world.

This is great and all, but the problem I'm finding is that the UI as a whole just sits right on the screen which makes looking at UI elements quite hard with double-vision resulting from looking "past" the UI.

I'm trying to find a way to adjust the UI to where the mouse is so I'm curious if there's either a way people know of to adjust the whole UI depth, and/or get the depth of the mouse.


Thanks for any help you can give me!
  Reply With Quote
07-15-13, 02:44 PM   #2
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by Brusalk View Post
When running in Steroscopic 3D mode with the mouse in software mode the mouse will auto-adjust it's depth to the depth of what it's over in the game world.

This is great and all, but the problem I'm finding is that the UI as a whole just sits right on the screen which makes looking at UI elements quite hard with double-vision resulting from looking "past" the UI.

I'm trying to find a way to adjust the UI to where the mouse is so I'm curious if there's either a way people know of to adjust the whole UI depth, and/or get the depth of the mouse.


Thanks for any help you can give me!
'Hey Brusalk! Syronius @ Kilrogg in <Modest> here. You can play with frame depth if you'd like. I believe that's the only parameter available in the API to adjust the 3D position. As far as determining the mouse depth, I don't believe that's possible.

Since all frame objects eventually parent to the main UIParent frame, you can try using the depth parameter on the UIParent frame as follows:

Lua Code:
  1. UIParent:SetDepth(value)

Alternatively you can have a mouse tracking system that will change the depth of the UIParent depending on the position of the mouse (probably the best way to do this).

Here's a rough untested script:
Lua Code:
  1. local f = CreateFrame("Frame",nil,UIParent)
  2. local scale = UIParent:GetEffectiveScale()
  3. local centerX = ((GetScreenWidth()*scale)/2)
  4. local centerY = ((GetScreenHeight()*scale)/2)
  5. local delayInt = 0.2 -- Delay integer limits update speed
  6.  
  7. f:SetScript("OnUpdate",function(self,elapsed)
  8.     delayInt = delayInt - elapsed
  9.     if delayInt < 0 then -- After delay has completed run code
  10.    
  11.         local x,y = GetCursorPosition()
  12.         local x,y = (x/scale),(y/scale) -- Adjusts for UI Scaling
  13.    
  14.         if (x < (centerX+200) and x > (centerX-200)) and (y < (centerY+200) and y > (centerY-200)) -- Center of the screen
  15.             UIParent:SetDepth(10)
  16.         elseif (x > (centerX+200) or x < (centerX-200)) or (y > (centerY+200) or y < (centerY-200)) then -- Outsides
  17.             UIParent:SetDepth(1)
  18.         end
  19.        
  20.         delayInt = 0.2 -- Reset integer after running code
  21.        
  22.     end
  23. end)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Stereoscopic 3D - Get Mouse Icon Depth or Adjust Global UI Depth?


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