Total RP 2
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Using Two libs for a better UI integration

2 posters

Go down

Using Two libs for a better UI integration Empty Using Two libs for a better UI integration

Post  CMCCallaghan Thu Feb 20, 2014 10:57 am

I modify a lot my user interface using a lot of addons (maybe too much)

Two of these addons is for my minimap and the other one to display Broker's addons.
I have modified for my own TRP2 file to use two specific libraries:
_LibDataBroker-1.1
_LibDBIcon-1.0

So what I did is not the best but it's a quick bit of code to use the two libraries:

In totalRP2.lua at the end of TRP2_OnLoaded() function I added this code:
Code:
  TRP2_MinimapButton:Hide()
  local LDB = LibStub("LibDataBroker-1.1", true):NewDataObject("totalRP2", {
    type = "launcher",
    icon = [[Interface\AddOns\totalRP2\Images\icon]],
    OnClick = function(clickedframe, button)
      if button == "RightButton" then
        if TRP2_RaccBar:IsVisible() then
          TRP2_RaccBar:Hide();
        else
          TRP2_RaccBar:Show();
        end
      else
        TRP2_OpenMainMenu(not TRP2MainFrame:IsVisible())
      end
    end,
    OnTooltipShow = function(tt)
      tt:AddLine("|cff1eff00Total RolePlay 2")
      tt:AddLine("|cffffff00Click: |cffffffffShow/hide TRP2 window.", 1, 1, 1)
      tt:AddLine("|cffffff00Right-click: |cffffffffShow/hide toolbar.", 1, 1, 1)
    end
  })
  if LDB then
    local LibDBIcon = LibStub("LibDBIcon-1.0", true)
     if LibDBIcon and not IsAddOnLoaded("Broker2FuBar") then
      LibDBIcon:Register("totalRP3", LDB, {hide=false,minimapPos=200,radius=80})
    end
  end
Of course this is not perfect but that way when I use bazooka (a data broker bar) I have the TRP2 icon in the bar as a launcher and not on my minimap anymore. Still I can choose to display the minimap icon whenever I want.
CMCCallaghan
CMCCallaghan
Developer

Posts : 25
Join date : 2014-02-18

Back to top Go down

Using Two libs for a better UI integration Empty Re: Using Two libs for a better UI integration

Post  Ellypse Thu Feb 20, 2014 11:42 am

Thank you for this suggestion (and the other one in the translation section, I've seen it but I didn't have time to reply yet).
I like the idea of using libraries as, like you said, it would allow a better integration with other addons.

I will look at it. In the meantime, I'm moving this topic to the development section, which you now have access Wink
Ellypse
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France

Back to top Go down

Using Two libs for a better UI integration Empty Re: Using Two libs for a better UI integration

Post  CMCCallaghan Thu Feb 20, 2014 11:56 am

Thank you for the access.

I didn't had too much time to look into the code, but I will try to see if we could use more Ace3 libraries to make the addon somehow lighter.

I'm also trying to reduce the amount of frames and buttons registered by the addon in order to recycle a lot of them (changing size texture and scripts)

But this is not something that should be a priority as it means a complete or almost complete rewrite of the addon. It might be good for the third version of the addon. As for myself I'm working on something else not related to total RP 2 Smile
CMCCallaghan
CMCCallaghan
Developer

Posts : 25
Join date : 2014-02-18

Back to top Go down

Using Two libs for a better UI integration Empty Re: Using Two libs for a better UI integration

Post  Ellypse Thu Feb 20, 2014 11:58 am

CMCCallaghan wrote:It might be good for the third version of the addon.
The what? scratch 
Ellypse
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France

Back to top Go down

Using Two libs for a better UI integration Empty Re: Using Two libs for a better UI integration

Post  CMCCallaghan Thu Feb 20, 2014 12:00 pm

total RP 3 :p

In other words and it's the most important, not something to really focus on right now Smile
CMCCallaghan
CMCCallaghan
Developer

Posts : 25
Join date : 2014-02-18

Back to top Go down

Using Two libs for a better UI integration Empty Re: Using Two libs for a better UI integration

Post  Ellypse Thu Feb 20, 2014 12:01 pm

What Total RP 3? I don't know what you are talking about !
Ellypse
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France

Back to top Go down

Using Two libs for a better UI integration Empty Re: Using Two libs for a better UI integration

Post  CMCCallaghan Thu Feb 20, 2014 12:07 pm

total RP 2 is basically a total rewrite of total RP which was abandonned by it's first author.

So if you completely rewrite the code then you might change the total RP number from 2 to 3. But once again it's not something important right now.

Anyway forget about it it was just a lil joke nothing more Smile
CMCCallaghan
CMCCallaghan
Developer

Posts : 25
Join date : 2014-02-18

Back to top Go down

Using Two libs for a better UI integration Empty Re: Using Two libs for a better UI integration

Post  Ellypse Thu Feb 20, 2014 12:18 pm

Oh, okay x) Well it's one thing to maintain an addon and an other to write a new one from scratch. I'm fairly new to .lua and addon development, so making an addon from scratch by myself would take me months, maybe years, to create something at least equivalent to Total RP 2.
Ellypse
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France

Back to top Go down

Using Two libs for a better UI integration Empty Re: Using Two libs for a better UI integration

Post  CMCCallaghan Thu Feb 20, 2014 12:30 pm

While using Ace3 libraries and many related libraries from wowace you can save a lot of time coding.

Also wowprogramming.com offers the complete api listing from wow interface and also all FrameXML files used by Blizzard for it's interface.
Of course it's long to develop an addon but once you have the basis of the addon then it's just how you are going to make your code.

For example in total RP2 I couldn't remove the minimap code from the xml file because the addon is testing something womewhere and I haven't found what and where. Due to this lack of knowledge from the addon's code I simply hide it and replace it with my own one.
CMCCallaghan
CMCCallaghan
Developer

Posts : 25
Join date : 2014-02-18

Back to top Go down

Using Two libs for a better UI integration Empty Re: Using Two libs for a better UI integration

Post  Ellypse Thu Feb 20, 2014 12:42 pm

I use wowprogramming.com, along with www.wowwiki.com/World_of_Warcraft_API (which I find better to browse), and wowAce's forum Smile Unfortunately, for times like yesterday's chaos, those sites are not always up to date. None of them were referencing the GetChatColored function. It's so sad Blizzard doesn't have a complete documentation for addon developers. I'm glad I had Telkostrasz to helped me yesterday Very Happy 
Ellypse
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France

Back to top Go down

Using Two libs for a better UI integration Empty Re: Using Two libs for a better UI integration

Post  Ellypse Fri Feb 21, 2014 4:26 am

By the way, I was looking for stuff in wowprogramming's artwork browser yesterday and it seems that it hasn't been updated to MoP Sad So you might want to be careful with the documentation there as it might not be up to date.
Ellypse
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France

Back to top Go down

Using Two libs for a better UI integration Empty Re: Using Two libs for a better UI integration

Post  CMCCallaghan Fri Feb 21, 2014 12:22 pm

I don't use wowprogramming for the artwork browser but for the API listing.

Not all functions are documented though.
CMCCallaghan
CMCCallaghan
Developer

Posts : 25
Join date : 2014-02-18

Back to top Go down

Using Two libs for a better UI integration Empty Re: Using Two libs for a better UI integration

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum