12.07.2015 Views

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

162 Part II ■ <strong>Programming</strong> in <strong>World</strong> <strong>of</strong> <strong>Warcraft</strong>Figure 9-10: BagBuddy with a square portrait imageNow you need to define the corresponding function in BagBuddy.lua:function BagBuddy_OnLoad(self)SetPortraitToTexture(self.portrait, i“Interface\\Icons\\INV_Misc_EngGizmos_30“)endAn OnLoad script is always passed a single argument, the frame itself. Justcall SetPortraitToTexture, passing in the portrait texture <strong>and</strong> the name <strong>of</strong> thetexture file to be displayed. Figure 9-11 shows the new version <strong>of</strong> the frame,without the edges sticking out at the corner.<strong>Creating</strong> Textures in LuaIn addition to creating frames, you can also create textures using Lua. Takethe definition <strong>of</strong> the portrait texture <strong>for</strong> BagBuddy:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!