Thread Tools Display Modes
03-17-16, 07:34 PM   #1
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
LibUtilities1.0 needs testers

While I am discussing code on the appropriate thread, I have put LibUtilities-1.0 into experimental status.

The Curseforge packager is doing its thing, as is the luadoc process. Hopefully there will be something soon. In the meantime, here is the link: http://www.wowace.com/addons/libutilities-1-0/

What it does:
  1. Pixel perfection
  2. Convert decimal to hex
  3. Parse item strings
  4. Round numbers to the nth decimal
  5. Give data about UI scale and screen resolution
  Reply With Quote
03-17-16, 09:26 PM   #2
Cybeloras
A Fallenroot Satyr
 
Cybeloras's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 28
  • You have a syntax error on line 2.
  • What does NumberToHex offer over just using string.format("%x", number)?
  • string_split("x", currResolution) doesn't work - you can't perform strsplit on a function.
  • GetCurrentResolution() doesn't return a string with an 'x' in it - it returns an index into the return values of GetScreenResolutions().
  • None of your functions are usable at all because they are all declared locally and are never made available outside your one file. I think you meant to define them as lib:PixelPerfect() and so on?

Considering it won't run at all, and even if it did and your functions were accessable, half the functions will throw errors, maybe you should test it yourself a little before asking for others to test it.

A tip on the design: Requiring implementors to call VisualData() before PixelPerfect() will start working (and also requiring them to 'just know' if they need to call VisualData() again because of external changes in order to keep PixelPerfect() working) is pretty bad design. Consider an implementation that doesn't require someone to do setup work in order to call PixelPerfect().

EDIT: Oh, and the CurseForge documenter (with .docmeta files) hasn't worked in years.

Last edited by Cybeloras : 03-17-16 at 09:29 PM. Reason: formatting
  Reply With Quote
03-21-16, 05:48 AM   #3
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
I have fixed all the issues listed. PixelPerfect internally calls VisualData, although you can still do so yourself.

And stupid Documenter! I wrote the API manually.

The first beta (tested, appears to work) is on Curse, and will be on Wowinterface soon.

Note, I removed the rounding function. After perusing the web, there were many versions, all doing things slightly differently, so I am leaving that to developer design rather than library implementation.
  Reply With Quote
03-21-16, 06:15 AM   #4
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
And Wowinterface has it now.
  Reply With Quote
03-21-16, 09:41 AM   #5
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
I don't see whats the point of this pixelperfect calls. All it gonna do is to create sizes thats 100% not round. And the game won't be able to determine on what pixel should it draw the frame, so it gonna look blurry.
  Reply With Quote
03-21-16, 04:04 PM   #6
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Some people have talked about this in past years. I don't know if there is a good fix, and I worked with what I have.

Beside the discussion already linked, I found a note here, which pretty much verified things, and didn't solve the blurriness.

If there is a better solution, I am all ears.
  Reply With Quote
03-21-16, 05:19 PM   #7
Nevcairiel
Premium Member
Premium Member
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 63
Honestly a general purpose utility library without a clear singular purpose seems overall not very appealing to me (others have had such ideas in the past). If there is a common problem with, say, pixel perfectness (I haven't looked at what this even does with it, just an example), maybe there should be a singular library that deals with this and only this.

A random collection of your helper functions is not likely to find many users beyond your own addons, I would imagine.
  Reply With Quote
03-21-16, 05:59 PM   #8
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by myrroddin View Post
Some people have talked about this in past years. I don't know if there is a good fix, and I worked with what I have.

Beside the discussion already linked, I found a note here, which pretty much verified things, and didn't solve the blurriness.

If there is a better solution, I am all ears.
Round the x, y values when you SetPoint the main frame if the frame is movable and avoid using left, top, bottom, right anchors. Use integer values when you SetPoint any other object on your main frame.



Also just use the common sense, like you will never be able to properly center a 2x2 pixel frame on a 3x3 pixel one. And the game is gonna blur the frame, to make it look like it's on the center.

Last edited by Resike : 03-21-16 at 06:36 PM.
  Reply With Quote
03-21-16, 06:16 PM   #9
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Yep, very blurry, which I was afraid might happen. Since SetPoint does take x, y as arguments, and most of the arguments are optional except for the first, couldn't you so something like:
Lua Code:
  1. -- if you want height/width
  2. myFrame:SetPoint("TOPLEFT", 100, 200)
  3. myFrame:SetHeight(myAddOn:PixelPerfect(150))
  4. myFrame:SetWidth(myAddOn:PixelPerfect(300))
  5.  
  6. -- might have to also run fonts through PixelPerfect?
Yes, I am testing this myself, but still building the code. To do earlier testing, I wrote a test AddOn that isn't truly useful, other than testing purposes.

Oh, and Nev, it might be nutty of me, but I am okay with generality, seeing how this lib was really for myself back in the day. I brought it out of mothballs, found it wasn't working, got it fixed with pointers and suggestions from these forums, and made it public.

On the other hand, if people want PixelPerfect and VisualData (they go hand in hand) split out, I can certainly do that instead.
  Reply With Quote
03-21-16, 06:32 PM   #10
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by myrroddin View Post
Yep, very blurry, which I was afraid might happen. Since SetPoint does take x, y as arguments, and most of the arguments are optional except for the first, couldn't you so something like:
Lua Code:
  1. -- if you want height/width
  2. myFrame:SetPoint("TOPLEFT", 100, 200)
  3. myFrame:SetHeight(myAddOn:PixelPerfect(150))
  4. myFrame:SetWidth(myAddOn:PixelPerfect(300))
  5.  
  6. -- might have to also run fonts through PixelPerfect?
Yes, I am testing this myself, but still building the code. To do earlier testing, I wrote a test AddOn that isn't truly useful, other than testing purposes.

Oh, and Nev, it might be nutty of me, but I am okay with generality, seeing how this lib was really for myself back in the day. I brought it out of mothballs, found it wasn't working, got it fixed with pointers and suggestions from these forums, and made it public.

On the other hand, if people want PixelPerfect and VisualData (they go hand in hand) split out, I can certainly do that instead.
I think the width and height values should be integers too, i'm not even sure if SetWidth and SetHeight can accept floats like SetPoint, never tried it.

About the FontStrings i could not found a solution yet. When a frame is movable and you move it around sometimes some of the fontstrings jiggle around 1-1 pixels and i have no clue why. And when you stop the moving/sizing that fontstring will get saved to that jiggled offset position.

It's weird tho, because the default blizzard frames like the player frame does not have this issue. Could be because of the xml definitions?
  Reply With Quote
03-21-16, 07:16 PM   #11
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
After some research, SetWidth, SetHeight, and SetPoint all use pixels which are integers. SetScale is a number rather than pixels, so it can accept integers and floats.

So my untested example would have to be rounded, or a user uses the first three normally, then PixelPerfect's the scale.

Edit: I didn't know about the jiggling in fonts, so won't speak to that. Possibly the same issue as SH, SW, SP?
  Reply With Quote
03-22-16, 09:15 AM   #12
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by myrroddin View Post
After some research, SetWidth, SetHeight, and SetPoint all use pixels which are integers. SetScale is a number rather than pixels, so it can accept integers and floats.

So my untested example would have to be rounded, or a user uses the first three normally, then PixelPerfect's the scale.

Edit: I didn't know about the jiggling in fonts, so won't speak to that. Possibly the same issue as SH, SW, SP?
Rounding SetPoint on the main frame is not needed for the frame itself, but for it's children objects to get aligned properly.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Alpha/Beta AddOns and Compilations » LibUtilities1.0 needs testers


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