1. #1

    Addon Lua: Missing borders on frames

    Hello everyone,

    I recently started programming my own addon and got into Lua. Everything is fine I progressed pretty far and I'm happy but I have ONE problem which I can't get fixed and it's on a pretty basic level too.

    So every frame I create uses a 1px border. In my wow installation where I code the addon everything looks perfect. In my REAL wow installation random borders of random frames disappear.

    As I was looking into the topic (I hardly found ANYTHING on this) I got 3 points which allegedly are the cause of this.
    1. placing frames between pixels
    2. UI Scaling is enabled
    3. Display mode is Windowed or Windowed (Fullscreen)

    I made sure to not place any frames between pixels but any tests with different options on UI scale or display modes don't make a difference. The problem is still existing.

    So with this (as an example)...
    Code:
    local backdrop = {
    	bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
    	edgeFile = "Interface\\ChatFrame\\ChatFrameBackground",
    	tile = false,
    	tileSize = 0,
    	edgeSize = 1
    };
    local frame = CreateFrame("Frame", "SomeIrrelevantName", UIParent);
    frame:SetFrameStrata("DIALOG");
    frame:SetBackdrop(backdrop);
    frame:SetBackdropColor(0.1, 0.1, 0.1, 1);
    frame:SetBackdropBorderColor(0, 0, 0, 1);
    frame:SetSize(250, 250);
    frame:SetPoint("CENTER", UIParent);
    ... I would create a frame on the center of my screen with a grey background and a black border.

    As I already mentioned I make sure to not place it between pixels: If I get new coordinates after dragging I floor the values (because you get stuff like 53.499999945).

    Has anyone any idea how I can fix this problem?

  2. #2
    The pixel grid in WoW does not align to the pixel grid of your monitor, and depends on your resolution and ui scale. This http://wow.gamepedia.com/UI_Scale explains that in a bit more detail.

  3. #3
    Thanks that helped a bit about clarifying the issue. I played a bit with setting the scale of frames or of the UI. The only solution that worked SOMEWHAT was setting the UI scale properly. Changing the scale value on frames didn't work. Probably because I did it wrong. Is there a way I DON'T have to set the UIScale? Because that's scales my whole UI up and I (and maybe others) don't really want to do that.
    Last edited by Aergwyn; 2016-03-23 at 06:45 PM.

  4. #4
    Calculate the right coordinates by taking into account the scaling factor. But I would recommend setting the right UI scale and then fixing up your ui. It makes stuff much easier when you have a aligned grid.

  5. #5
    Well except UIScale nothing works. And UIScale is not an acceptable option. And I can't find how other addons do it. *warglbargl*

    EDIT:
    Okay I found that ElvUI sets the CVAR
    Code:
    SetCVar("useUiScale", 1);
    SetCVar("uiScale", scale);
    And the scale it sets to is "0.64999997615814"
    But with my resolution of 1920x1080 the 768/1080 formula would result in "0.71111111111111".

    The latter value would destroy my whole UI but works with my addon. I'm totally confused right now.

    - - - Updated - - -

    The problem still persists and I'm still searching for a solution without setting CVars. I can't really wrap my head around the calculation of coordinates and/or sizes because that too still fails to produce results.
    Last edited by Aergwyn; 2016-03-23 at 08:55 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •