Thread: Grid
View Single Post
09/02/14, 04:26 PM   #17
skyraker
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 154
Originally Posted by merlight View Post
Tried it, at first I didn't see any issues with line width. Normally I'm playing in windowed fullscreen in native resolution (1920x1080), so GetUIGlobalScale() was 1. When I switched to windowed, GetUIGlobalScale() changed to 0.6something and the grid looked really bad.

I also rewrote grid creation so that line width and grid size settings are in pixels. That is, I divided them by UI scale. But even so, some lines appeared thicker probably due to accumulation of rounding errors. Finally I disabled pixel rounding and it looks ok now.

Here's my modified code: https://gist.github.com/merlight/25e02368a1e6187f989c
In addition to the pixel changes described above, there are some more:
- I'm anchoring lines to TOP/LEFT (center), so the red lines have zero offsets and thus they're in the true center
- only every 10th line has full opacity from settings; in-between lines have 40% or 70% opacity (this doesn't work with changing the setting on the fly)
- I wanted to force the red lines to be drawn last, so they're not overlapped by the black ones; but I doubt showing them last will ensure that; perhaps we should SetDrawLevel?
Nice changes. My next update will incorporate your changes, as well as update settings to take advantage of this. For now, the 'fix' for changing transparency I decided to use was to simply adjust the TLW transparency.

Setting the two red lines as being last to be drawn made sure they were over all others. At least on my screen they are.
  Reply With Quote