Using Lua, how would one go about getting the height and width, in standard _GmodRect_SetPos (,,h,w) format, accounting for various screen resolutions, of a Entity in the HUD?
(if you know of a mod/script/function that has been released, and can provide link to it, please do!)
Gmod Rect uses 0 to 1 for its X/Y co-ordinates, so
Rect_Set(.5,.5 would place the start of the rectangle in the center of the screen, and (.5,.5, .5,.5) where the last two are height/width of rectangle, would make the rectangle fill lower-right quadrant of the users screen.
However, how would I adjust the height/width dynamically depending on how close I am to an ent? Things farther away would have much smaller height/width perspective than closer of course.
------------------------------------------------------
| |2| |
| |
| |
| |
| |
| w |
| -|- | | |
| | 1 | h |
| |___| |
| |
| |
| |
| |
------------------------------------------------------
Say 1 and 2 in my 'hud' above are trashcans/barrels,whatever.
I know I can use EntGetPos to grab vectors, but how would I get the h/w they're using of my screen?