Thread: Grid
View Single Post
09/01/14, 09:11 PM   #16
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
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?
  Reply With Quote